0% found this document useful (0 votes)
30 views5 pages

Oop Assign 3

Uploaded by

officialanas589
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
30 views5 pages

Oop Assign 3

Uploaded by

officialanas589
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 5
Nee Mohammad Anas ‘Oop (SE Compulery Rol no \- or ae | assipnmank — 3 assiprmank — 2 Ques i\~ Whed is opovadoy aver loading 3 why th mocessary te overdogd On Speretor % Aug 7 opewates 6 verbeadi asc feature that alters g You 40 define tustom — behaviey for cxperadorss ® GS tor =>, Whom uged toil you oon clagys, tf emhaceed code weadability » mates Custom dypes behave bike build RY PES yA ite guotes with Aarnguage faokeres, Rvevidiorg & move intuitive cud expressive programming LM PCHTeEH EO, t. Reodabihidy and enpressivensss v Oven heading eperodoys Con : make your Coda more sreodable aad excpresstue. for ce pl > Tf You have & ‘vector? class ion oa = veckor (1,23) a Va = vector (45 56) segult = vi Ve %- Komsistenty with pullin types) overloading operators allows You Custom types to behave move hike bulld-im types. a “ey = Lommphen (192) Ce = Complor(as 4) | welt = tee B-Lxdeqration telth lunguage features’ epercter everloads ts offen MSCd in Conguction with efhoy Language | Fepiuves. Bx | obit = My Clow (’..) i ober = My clo (-.) | if obf4 == obser lowte 1 down pw Operators? ae Be (class Number § def -- tnid-- (calf » value) Self. velue = vtue def -- ney -- (self)! sein Numboy (- Self value) def -- pos-- (self)! sseduyn Number (Sly » value) def -- she -- Csel{): yotun str (self vole) mumi . Number C5) mum 2 = -nuum cyaum {ie PML » print Cb original Sumber: 5 um) rg CE Genny, MUMS Rogult - "7, vuvm2) Qu “y » Print CE eenany PLS eogult 17 Rum s, Ours BI) Write a pregram in cet to Use seope v~sasalartien oe! eporaker, png te at imelude ¢ rostieam> chess my class § Public + ; caotic int chassvariabse 3 Void display elassvariable C Pay : std couk doay 0} ; Shapt 2-a dvaw O} @ussiton St Wrote fe ws. dima polymorphism a i hots ached dm Cot » Ex plone if along aot th encamphe , fone Run tine gebymenphism im coe )- Runtine poly movers in crt is aan ete el Sunchlons ond peimders {te base Case Seeks, | Tt Ulows oozartd of different lasses to be treated th seough a common Interface » With the opp vo priaty moths berorg tn ve kod ay nari otly oh sunding, Be. ft imelude < 10 Sis chavs haga L <= a oS er ji q, lay Ure | eUbUC vhape L Qube’ Veld dots O Const wer pide f SAN Gud << Mf Drawing 4 ale” ce stadt thd uy ttass Reclange + public shape f Qulolic: wieid draco Od Const evesnide SHA teul ce [Drawing A vectargle.” ; << stdis endl cs tml mand | a shape® sheyped = new efrcke O54 Shrapet shaper = new Rehavgte O3 » Shape r-> daaw O)} Brope 2 drawl) } delete rupee £ } dilehe shape 2} selurn 05

You might also like