0% found this document useful (0 votes)
52 views

Oop Notes 1

Uploaded by

Surendra Pandit
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)
52 views

Oop Notes 1

Uploaded by

Surendra Pandit
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/ 153
—irtreduetion to 00P Dyyerence be-hoeen O0fF a PoP t I Parameter PoP Ss procedure [OOP Te objects Basic akefiri Bien onenteol- | oRentee} 7 Program Brictonftke proqram F< duitThe program fs div pled ‘into poncbons-| ito obpects. j | Approach t+ Ss top-doon I+ ts bottom-up i . Approach approach Tt colo not have Tt hah ateceds spe f ‘AcceBS Spe. Sf access specifiers, fie rs Tike poblie pry] lake 4 prokecteo) | Data Hidlfng d flere Ss Ao proper @y Date, 9s_Hicldtn ta S pecud lot idling dotd, go roles pula pRisat* pro eka data 8&” Gngecuve. fhence dats ceanty trragal Code cevsqbiti[Ne coe eeusabilihy [The -eristing'cOske can v be reusesp AY|Prowlem Leno Not sOirable Cer slip Used for eolving [bq prebienss probien. BDilOverleaofing [r+ folloas no |B follocoe eperdor wed. UO] xertoadiag, R febetion overloading CO t 3] Enarnple- 2, VB, FORTRAN , G+ TAVA VENER : PA goo Ge. RET woreeh can woe accessed & usec} Of that < (ass. 4 || Tn hedtarce: Mrnettence 2% one of the most Frportant featore ef osyect Osented Preqraram VG s ° bee apart’ of chs bo dice properties & Tek ee eed Qnether 2lass “ie calieal onentene. = Tr allows Us HO create a No clasts (denved ¢ lerom an enichng Class( bate Clate) The dep ved class % A Emhevits the Reahsre from bake | class 2 can have QdulTHon pea’ture & oP 14 oun for Srampie, claus Arto! cl) eat ( \ tbnetion Iigleep fonction 4 clars Des! peblic Animal sf Mboark( ) fort tory, dy Polymorphism Z + |Polumerpinem % an object -ariented preg ranitin concept svat wepeRe to the adil? of-a Cabs fle, fanetion ar elyect tb -tabes mv 4 pie PE Or Me : lupes of lymo . (ype ot Poly morphism | lor file Ame Wynnprfifisnny | = Eromple’ fonAion itieely ° Rontime lymoronis™ q Borgekiveal fonclon {Ex e- Brapevla Sion psulafion 4. one of jue focdascertl conte pig, 1N_obyect ~-onented man ey CooPY worapprel Age ust} Re Knowon ob encapatation = 2p ef data: he Fnclucle Zceonto- h> using Namespa ce ete; Bar Sumintas Wnt ©) + Foe 62 a8: return (S$) 5 ant anint ) 4 Ft aa bt, Gb | cout <é "' énter the value of chand b 4" cera} in >SaL>>biLb; ga egum( 441 &4); pray con 2e"the sum 9s!" 2 2545 veturn (0); “aioe function are Hoge fineHod hat Fe Capanded online. Bhenthe funchon Se called with Hs cerresp- Fonoling Values. § 2 SR we overnead me JD calla func von Re qraghtn men —ne ewecition 38me. at func4o9 coale then the tune-fon gnetle pe made Qa Ialtro ancl the funcRen talls ave veplaceal by Lunefocock. ee [Sarton for tnfine punches name(argument(s. Saline rehurnty pe puntfon= § JI beoly of Fn line fun Hoo Advantage: SS cinline puncHen till make enecutfen4 og Ishor er for tne funcHen ust fewer Vineg oft kp ole. Digad va ntaqe- Tf the punter eoithlarger Number - of Codes on th fe beter to. Uke Normnl fureton Anlin e netion: SH dloetnot cOork for yecureive & Tt+eratPue COLE WAP to calecetote GT uttiog the concept gp Salve. [punched his M Snclude fiostreamS Uusoy namegpace cto): Pats Be - me_ float cle weE7ploat Pi float _& ftoeb 4) s float s=( p¥ tr) /100; xeturol 6); at main ( ) f x r Date: e “SL ttoat pi, t4iei; ¥ tec" Ger Ane val + fout ee’ &n evaluek Of parity atean ei n>? pL>>ti>> ray oa Float C4 > uding namespace std: Ant wedin£ ) 4 Tn mas « ont Ga=mn:, tladg veference Vanable af x j A=ard5 Ines CoutZetthe yatue of w Is" 227 26 enalls iF rt xetusn(); Ee Ty I] poss of reperences- Yast ey eke th can also PAS The valy ky reference Gre Ine but here we se the ancept of reference variable +o pass 4 wef S= void cap (irefa_, Intb) ink erp =O; a= b=+™p, Emample tMinclide 2 Sastream arinclude cconto- h> ubing namespace Sal’ VeFisccapCint Ga Tots) ip, ab are reertnee : Say Hemp =a: azb! b= temp} 7 Sat man’) ¢ “io yy y Court cat Enrerave value or Ly "Ze Aans>H 224 " Course su pore Swapp tag" 2cendlee Vm =" em 2 cendlZz*ysapecnal: SamapCng) J aet+che)+ eetum O° Ae Coe afte F Coq hg! ec enalleg mola ateceng| Zeya czy econd 4 eone “3 calculate are & pehnetor Ro ofunchen 8 display tne eae 4 # firjoclude Cloctreaw’s inclu de. Zcohio: h> using Namespace. ctl; pdidtre cteingle (8 atl arb | Intga is | a=A*b; P22*(Atb); ae maint ) § Ant 2) bat, Pl5 eout 22"Enter me value of rengh & breach, rable. of rectangten zeendl; Bin SSL>P>b; wectangie (Ay 5 O41 pl) i_Punct ny call . Betch O: < THE CES aes g cenaggrel~s | Yeturn (0 ay | me | DlvoAP TW CAcuLate +sq,csa X volun of a ge Find} 1g Ain a-furcfion 4 display The Besult Ta mein). | 1 tude Ziacheg nj lezenq]: PRinctade Lconto: hS mang namespace std; VAT wyin dev Chia tr, £ loot h | Hoat Ftsq if loat dea float Fv) © e072 8 Wis rae), a= 2K Gaye ere) Vely = Qa years rah’ Aint main CL) & float mh, @)+)c1Va¢ Coutece nter the value of vad 3 neigh cy lind , 8ins>r>>h: ceraler Cx, hit,c Wade Pout zen tear Zctecendlez Nesee’ Put luding Namespace Gtely Rat émax(int Fa, Far Gy) Iretarn by reference IS 9p Ca>4) return(ny; ethe ¢ a Yeturniy): 4 Gab main ( | “ink MLE, yao: max (4 4s) =a 1 )punctlor Cali por erin by cout 2é""MHE value of nigtZe nce end lee The vale Of "6 y 4s" ec yrecendl; “J of setuml o); 4 Olepau HH aigunent value ht beta ee et Fe {ligrorple< of dle fault agurrent rile Tostrea hits axing Names, Gat eum Cin ay aint oS) yeturnCatb); > Jat _ondin() im A+ aay cout 22 Ener tHe value of ai! Zend A Gnwaa Coulec) me sum fe ze cima fadyBaz end : £e muy plo)! 4 Depot aauments C+r Allods progvanmmer te ed a Fat Lorthout speciguin a QWs argu Pin Kuch cases function ass3q a Bef H Value +n the porameter bslich Aénet have _matceding agquenen* Sin funeBon cout For Cpeat dlaecalesi flat p, Pleat 2% pleat =>. 8) VER rave clepatel aroeateis - oi Twake defauly ayqunent are used tohen same varable Wed cordtant om al ved Knom value file Faterest YHE Hime che Date; f j UDO AL eee Sfaut way + Me £50 + * Sorry 0D tee) _ Lc fe oat Anrcredl CFtoak Prfloat ©, Tae] Alodt Snreread Cptoat p = 2600 Porte : Is O9P +p calcukote ST by uingethe concept of default argument astog “detautt value of [Rojeres E oft. UY Fn Aude > pa sy tis coute ce S-14s" ce Paterest(pa pt >sli Spbs: Coot 24! 'IMe. areq of reotargle, Pslee Oren (Lina) yeturn Co); - 4 jy Ch rey — 9, Class 4_Obyfe CE: ~|Aetoss Fs a coay te Wad data Ff Joes oc tated Function together —it- alloca dit X pune Fan ap be Rdder ) necessary from the eniema) Cae. d Sanaa Class meens x94 ng 4 Wom oe fineat eta py pea that we Aaue as base olaia Fy pe - = rence A Class thax Leen Crd | egy COL ean OA FE anu no of obyeot belonStng fe that lass. Oo RF TW The general suetot for ewatina ac lass Fe Ca Sunray TI OlaSS. CASs~name prs vate. obra Mem bes: member +tuneton: public’, clata member; 2, B, rae Mnber (ARTO, Nenol oF class Poblres = Vota Yoput C) — Hb ody = dtgyleyl ) TB ooly a Tread =f class - —lelaas declaraPon % simtlor to gtrocty Qeelarg ton =| private 8 publ?e Are vi Ga7rSty levetopcta ahaa $s contetng both alata 4 oflirtion late are callea) lata member ¢ funttien are alld menber functor. data _§ funeHon thork ar Aeped tdde pha seco oye Not U6 PbIe OF Acal/e Pro looks? de tne c tne Word Pov ete optina) theda membe Clas a - Pop 2 by defalul gia enerally ata are plac in pu ie, neWen are Placed In pobhic eecdonen Line ludeZfastreand we Namespace. srel- LIASS ctudlent puedes char name(2ol, acld [20 | fac Leo), fn Fl publtc: _| vot A fnput( ) Coot ZZ ep er WE Dare addres q Faculiya%d of studlen’Ze end]; Sn dS ame soe Hee syd: 2 jorel_olisplayC) tor $ Cov F Se" nang se, rare, erp\\ <2 adele 2M eccag ee ip ipadultry= neepacecend a 4 ‘ eg Of tho_¢ lags cormimve [creatine object once a elags hoa- been cregied, we can creahe vaables of tat cobs by Using C088 awe Oe Pe called obyect og “that clase. 4 i : class—hnang Obyett —no me iy Ta main’) 4 Cider 6, Ws 1s an obyerts a Ve aH rng He Wey Fo oreo O% 0b; an Clase class~ nano ‘ 1 boy Of Clas 4 abpect { S) For lass Stu clenp UV body epclag AS Is % on ch secy J. [7] acteas?oq he, Olea member of pmcsen Sr, 7 member “of clase : - AS we ents the Jota Moe pBvate cannoh _ be accedsed +e can accetc Only pob ie 4 furc+Peon porch Re qecoaced § Ace) peva-by. Tp 6 canto arces Sing dara memben ow - NBO 1 Class sy era 1 + & oeyett+ fhe +500 (No argslare re aie Oboe Lt. data member. + “2... req: y eae “Tnpob ¢ &: olisplay( c Gat main’ J) Stucke nF S Ss: Tn potl \ < ofspla a’, cahint or” a of rectangle. Aone 4D fied aren 8 pedme fer 3 Udine foe J concer a clase ¥ obpect: aH inc ladle < Soetreamys using Mamespace etd; 2 Wlass reetamie pRva eh Sor hy s, APs pubes Vee of joputl ) $ v cout <<" Ener tre _lerggth & bree, of rectanqiel ae Eno} |, C = CINSS\oa>b- ey es cale —apO) Oz L¥b° p= 2x*U+%): Noid dis play()a a0 Coot 249 of veatget 2ca Zce _| " on, of an =zNn< 4p. 2 P T Me End of CMSs = Prat mahal e x rectangle red r&s an Obyeot co Sopot(); G cale ~apl); ¥. clisptay ‘ey retum@} aE BaP Ad calculate QE using she. conceph etags & obye te mclude ciachreams 4 res pace. etd: Oa garople Pruadte : Port: et oh ; cop Eger Enter the value of Pit & Ve ein >>p Str, usd sale st) = prt «1 /Too veal_ots pay Cut ZZ the Cimipte Wn werd s"Zlizce Zllenst ap goss aie main ( Genple sf G- In put f |r Secalc-Si a+ display(): aetch bl Yeturm (Oy) 4 a wonP to calculat We TSA OSA R wotume of cufincler Using the. concery of class & abryett include Ziostrearys uileg_Carnesgpace. tel; T clos, cyfinde 6 Sy $ Prvate: Jia tas, bY, TSO, ce Vol; Vi a: 7 Void Inport) - Coote "Enter tne tadl FAG SF rc din SS SSh: ered; 4 vod af coleutate( ) a 5 Pinas i TSA > Qed AC Thy ae rr CSA = 2K 3 aMIER rHh! in f- vo) 23:14 16tRe re hs ae Eo an Aeeplayl] t Coul Ze"TeA =" CATSA Ke aca 5 ZeSA Le end xz velund =" evden: J Mend bf The. ca main. tyfirder ea; Me's an object & input l); Ce che-plocalevlate{ ): ¢ as floyc ) : Z : TeturnYo)7 te ceendly, Gin Sd MLDS MLZ? Ye d2Ye Roel eq les dist ©) | - d=aqrt( powslM7-%1)2)4 Pesta y i wi 0) alts fay) T TOOL Me digtarre DeRPeA aw pol | Geese Zeendl | T ooh ee ink The value of mh Ey YLT 7 > 423) eet ae ee oto pos " Fa oa2 Pet 7 ~ ras Creat. Q class eGied employee (ai Sa tqnember name, encanta a PS lS et 3 names Sols Ou uer4 lela mployee — | Gat A ~ n ~ loge «sal eee | < oor ze"nier the name , Paid pow Rca es eraplyce ces od | D> nae ad Sp Sauls SF + ia & did Acar ) Coot 42" Warre =" Zenare Zéendl 2g — {post aN eeposk ecerdjaaildtZ4 "idl Z2end) 21 salary = 222 endly ' ou f+ 1S Ape); . é | eD. nporl)* ome roployce ate" 2 cent ! ea: fig pay), | ‘Crate a cla, called student ith date ___ BE nclude Zpaeeangs — 819]. Marnespace Gre} ___ lags chident —_ a fern di ee eee —_____ char narn, int_ maint). Sey J Shident 64 6b a3 sey opt Si S2- Inn! $35) ¥; Br. Aroplay()* Sey oe, A OS - AisAtyCh’ return (oy [[Larray Of obfect we have tn nalte -kOo or more +nan Oo ObyElE -then coe rate “He array of — + + ii tue_oby Class name _obyebt-nome(Cno-of aby) — pe Sr Gudlent USIAG Names pace stds Clasgy Student i wate: chav Qame C30) . LOCOS : ——_. ———<— Sak Id: UNG: I void inpotl) e— U coutec"Entet the name emma iL of 8 arudents" 22 ena); ~ je | ein sy Name V7d >> I es ofsplay cout2e "Namen ZENAMC Ze endl Ze! facolt WE fac Ze endi> Name sy pastor day gollatyss* J Gen ucia A splayt ) ¥ cout2d the details af employects grelzetndls Coutdc Namea''¢4nameZzzendiaet 46 post 6 Lendl LeED seadezenda * salary = Zésaiany <2erd LL |< 3, & Sot_orfind ) $ employee eC1o}; nt is oh for [207% a, Hy rE gnc : =) eputi_/ it —— int f+ | ; Bowfie, 128.0 fn poy) eee ee Cootaz NEnter fhe value of 4k Oi velo Gin S>¢4 3340! ee Ui d aold — Relelickone, sauce alt ech | § eh ii Fnzd an ade Any —— ers = ne 24 a at iL Coot 22" Inch =! Zein 2 zend) eel feck | Lett ceerd|, Nas ies MaFnt) OR Eance ln, d2 das CAs neal 2.9 npot( \", AD. adda - cst (du ddI paso] anech d- @ a ap weturn io): Dae: ff _ Dileveake A class colNeol me Sem dota rreriey, hr, in fase LDAP =p add 220 me aby ae. |X Sisota: a ime 3 eencoord include fo, compler Safe Tusing |_ namespace ste): endl fetats Ame _- é prvate. rixeck- 26 | fot hr, nie, © rae public 7 wo | vid 8a putt) | § | ‘tout << "Ente se the value hoor, min Se Cord" a Zend\; Zz ny hY SS NIBH >> 3405 of A add- mel bine. Es, tme 2 )F g TAs nv 9 obser ad SUT a rquirerd Sz EA- sec 4t2G60ed* Mine t 1. mn} emin + Sec SE = SEC @ Jofo} lor = pa. bya toby 4 min160, min san 66 | Vaal ds pout 5 spout) | cout N ques Ussing) namespace, Sto: ola Com ple : ~preabes t o int veal Ams: pulotic + void Spat j $ cout Zc"Enter Are req) 2 Keng naryape , SS OF conyplex. Qumber! veal ims , . 35 acdc omplen Gonnplen £ c1. , complexe) s- real =ct-vreol + co-senb Reaves cheIme + 2am: | 4 Sd dt. yt ) vet Fen Wine sumatyen Ais! $é £ Conk ee reagent! 2e8 Nene, Zs A Ys ia wort ) & Coraplet CL | C2 £3; | ci. Snpub 3 €2- Inport CY / £3: Addon ie abs Soe xeturn (0); Hu cekuring ooyect, we Fn also Be Her tne bye (Ht fafa puerto for Aiis 02 Use Class Name as ‘ecstre 4upee es KS issn name ( return -rupe) pilin ee Create. a ClaSE: we, Compl eK warn dat TweMloe r weal Vey wep B aad Ws Cowgl ox ae Frese le on Main que ¢ tite Pi Date: = Snetucde a —= unin ramespace. std: Fe Class complex y Sa eee Sot Teal i are oe: i = via faput I . tout ce" Enter The reo and Imagh : Conplee nurberh 22 ena]: Se 3 2 >> reo! sy ‘ime: | complext . add comple xSeampler. Ca, tom complex 3€ MP? temp veal = a. eal Fe: vel, temp Wenz = Ca Ima +C2-9m2: | xeturn (+e mp)! 4 voktd Fesayl) =e na main ()L bed aed Cout us) HarneSpace. tol: cla Ase, @Mnvates “ine Sm hv, day, Public: void Snpotl) erti| Cout 22) enter the value of Bec iD, hoor Oe Zin S>_Sy> mSvhys> day! SI time addtne (Sme ta, Eime 9) af me 23 [3 BRAMPTON obser - 43. 80 Ser srts.c, S e tarm= 14i-m+ AS: tae 43-8 [@, 43° $ = 13'S ofa: EB AYE Cs bY 49. ht 43: rl 60" a. ESM = t8-m eK £3 ee ta tie £2 cay AF pele or sb ah Se lacs i ae gy oe ee | pot 2a gecods" Ler jacana nuk 24 ene ~——_| ¢ void displayl J "day | z2endl zz"nour +! <¢hnecerdz wae day ee enh, __—_ I_% - es . : | rae | & 42 id : | 1 ime tan a (2-19 po yy $2 %3- addtine( £1 t2)$ ~ tds play/ ) __—4 = ret sno); 4 : ey Geate a class called oQstance edit deta TPistane ouyect 2 cisploy Hie resa bin vei) TEND, em, hm Pm. OARAO ald Od _ EE Sac lude 2 fastrenm> || exes gq_namespace stl: aes Aistance im |" paete: kt a7 Sat em, mem; ubties vere § opus (aa) as Cock <é" Eqier theme of centindles wwetey j | & Bloneper! eemlly {| 7 Oem >2KM; io | 4 ‘ [At stance adddisBanc=@ Sistene ds, diseney_| sf | Atakine dB I1d3 fs temp Obyoet. OBecm= aiscmid2.em} AB mM = diem alaem + 3-er |1co; AQ. crn = AQ-eme/atoo- Ag km = ole krn4y AD lem_4.1 Be ml 1000; AZ m1 = ABM */t 10007 wre hirntd3) + ”~ aA Afsp layt ) cout ae certo mera! 226m 2e endl Ze" hess Ss" 2em zzend| Ze"cipopr s22revcend|; 4 i} 2s fat maint ) I$ 1 aigtance ok dz ila: | das. Sn ue | a2 AnpetO$ +] AS mut adddiskance Coy cl): q a3: alispiad \; | weturnloy, i prough out the “a EreSoe allocated at the time + lonty one copy of the tat gets Hs meroty a cla SAtio el abe 4s crea ™~ Pp is 9s chaved he on ee e ei These vakables be 80 C | N ———+t eqramner eutdicle the class_OOfy-— tT can be aacesse lay clouds me opsrd | vakabe. Is decimed aed eet © word Vista Hell Ss placed. be re ta 2 eck | See Syste. coacy fot egy | | See dito_ *ype Vabarle_ mine: " Store Sint ws | Fie A otake VaBalb le mus ke epi red oo PN he clase: t | defi rg Shefe- arab? _ayatea ' | Aorta type clase rarer? Vawable nawes, by PE elma eally “ah afited hy 8 > pier Sis deo (afar outside class T —ant/ le: a . incluce ——-—__9 [= aaieaPi ve. static varale cz, we ce can ato __. definitian Gate — ud dunn Tether» a = —fuaiigie ee ef alass— name Vang ble name Ville jay Pe Sal i a _ sper b stow i | a —=—— 7 : _ te 7 ee at Sate member metron.- A Stet. member | nefien can access only steatte alate member) ibut anormal fant isn Can access bol she ~—t Henmal. data trembeh : ~ ad S ra f aE Grae veturn type purction — navel) } ——r ‘ [[ocely U ~~ i “, Hee Sc tude Zostream am LUding namespace sted; ya = sett" ~ ] af | phate: : ‘ | Sint [lnormal dated — stake fot counts Ifstatic, dota ~~ | public: ~ Udi input() i ~~ Veout 2euGhitr The value. of og eer em in ~~ a Gtahe void Aspray coun [Te clef § fine COEEITRVA Ue Of corral Wl eerooes 4 endl ‘ coot _ lusing namespace, _shd; class +esat — _Phvat e:, L i | | fat ny If ct reat) [consruchs Udefant consti £ yeu % ae Vaid Aisplayt) ov cove a! the oqlue of 16 2oy d¢ery | 22. The vale of of As! 22 Leen > dH: Ni gy win) fad ty Ti construct, WyinenaHcal 4 eg led. re A’ spla i tohen okgec $ Creq veturndo): 3 He fnctude ZiostveonS, uso NAMEAPACE dy clogs test hes, +e} |) 8 ZU CGPS FURS ce, ae a esl an Badd yetum (0)! je ee ee ——Tupes of constructor: ! Basically There are Three types of conttructye oe: act Conshru can | Ren = harameteR red conPruch) £ pate meth ted Con structor construchs Dip. wlt Conttructors- The Constructor srl take Ne argument is for PVA 9,745 af 29 Hon iy cat ee? olefaut+ constructor. | For €9: Fag reticle dTodrearne et, I) oS , Pomnespace. i“ one [claus test i ft Pivate, ll “int ™, i Public ee test) LU depaust constuce t I Na1Os a | 4 Gres cee Mates ff void cfieplay () ana - | > 7 I cout 22". Tre value of as Neer cendl 2 othe I vel, oiler Ueccer, 1 a op uv i lent_anin() | teat +; [Leonxbructor ave _acctonaarficalliyca Lhe + olispl Cys Haren chyet creed. | veturn 0; 3 9) Pacametefized Constructor - [The constructon thar takes our imeyi Chap) lap SA Batre thevodle of dain member Ss edffes paxametdrzcol constructor: Ne = ein jude. < Sostreams Juxiog mamesmice (ctf. clase Hest i I< 1 prvates Sat my: puofics —c Te teak inka fink b)_ [iparamekned con S -tor N=Q =h; de : tout an! Tne Value Of bac A a atint ) —.$ tert ti(usy ff eas Aras w ted coraituy . ta. die plat Ke ceturn oF yr 4 a D Copy Construct the constucer tot us) oter z obyerts eb value tp wifalizm value o eb i Sq COUR Copy corstructyr. I+ Copficr the’ { ~ Valse of_cimler Aadault contttuCtnn cores? Fae Const ty onh38 aSize d j ie ee inlude 2 feadrean i xe . 5 Clase? ted iid Afep play L ) Couted' he value Of Wiech cee) UWThe yalue of 4%s "eeu ern z mainly test t4; Jt default Lae dfcpa sa; tex} 49 ub). Lp CUS povametenrd contre ADs oMepkiy ( \- Limsy Uh Fest 43(¥2)s" 11 copy Lenaivuc tor ca ll enprer cal Be display ce’): (copies Woleef 45 7 Constsuctr Gt 5+ 44242: Ile eu constructor dalicimptes Yeturn CO}: 4 mae: f/f 23 Constructor Overloading: 2 —in class, we cad) have Aipeewht const ~~ with name. witch 4s called conseinictow: ~ ae everlood- Querieaded Constructor mutt haves ~ a 4+) Ne- of Orguivent (Snes) Should be the ey ae, TfL Me. : ar qui sate -then f |= “ype Ghewld be! alitheren|, ~—— 12 _ g Sanco as agach Ko J Pt i ensiruin al arqumment value) as We can al& have chartruchs ust ea i. anqumensCPn pu) which Ps ghaon “in emi i a [betes ; te ol nelude Sestreons j ag uss Hamespae. Gel; I Pu class eet ~__ Is ie prwates r~ fat ny P Ne | Public: | pee USI nN Namespace. Sted; . a claks Fest : —— 1 a a Public: j x Saotn = pube E ie t on T deface Cong . ~ I : i\A Te 3S ey, ‘best Cinta, Int ) Trtors tb aa i™~ e “i Sara; “ss oe ae Ei , oe I eo, Al, 1 void dic ley | a | cout < el The Lnfus. Of H F522 neeagl ee " co | ‘The. Valut apy Serz y ced |: is j tJ = ; a. | etest) [this Fis oleffvuctor 2 { : a | court él lagta mromber value ; w te demoed" 22 0nd|y i hes: wena bee ens - id . |S en) Ay liolepaurtt ous. CALp Ty : ji Dae f / En aiapegh — “po 204) 42+ Ah splay; qeich (\) Tretunn 6); 7 4 D Ovo-+pvt® [tre vglue et ist || jhe value ap 4 PS aS The valué ‘of ¥ Cm me value of ¢ 8 Aata _ pontoel vu ahere destroyed hue th 1 YW I S| create a class a\led eta rle cain deer mayer | Peet R Sach. en adize ay te alata meer [Fee's consrsuctoy: Ushio necesstny mem?” unc jones conte_a probe +p add 4102 aig tate. olyect: ! Tee ncluce = foh pti chy P+ 4 Sach /1 2: ach = inch s/ot2> mS void cfu pigy) —_— Lo coutcé" Feet = <4fh Zeend) Ze Mnch” —_T cinch 2eerdy <= ___t Yor watac) tt Is ___ Aston ce dafas 3) 2/9) 43; —— _d3- acti’s* fos 9): —— 3 ofisplayOs veturn CO); + Ly 6 | | | Dl Create a cogs led frre hading as I Trnenbee hr, nin, cea tnitiafize we [Phe nvboer a conchoucton Buse necexsniy | iroemben funeHay +0 acl oo Ame 7 / ee: [ _} a displag “the Wa IF a mein S 0 taint) —-L i | Mates ff en : mg = 7 —_ )r- a sd) —madcompleomple® aa cS veal - ca. Veal + 6% ceol Marr ff / compen 02 yr =r = ah. mg +o Im8 Aa AO ‘ ore Deaar ee read & Ze no) 22! revng’- nate Zeimges ert); + ib SD eg ee es (este, tage ve turnld 4 q | | — Date: v / Chapter -S ae foi = mr Overloading Leet questing Opener Overloadin: were aa) Saq to rishi gf _operoriar- __overtoadling use Can ae ing Fo eriisHing Oper ior a | = Z She fue +, — so, # Sy) : loMeh Gre by Aefault Suppased 4p coo rk [standard data +ypes dled, Peapf/ Operatar that Connot be owrloadedd stcotly we operator that cant be orhad: ares Tittace ember acceks operciton (-) osdet open} 2 [Scope Fes oluhian operttor (2 + | Szeop Opercton (sizeot u] CondiHonal Operator (2 8) [char StriC2oy ="naton al Ws khar G4tr2[ 20) = Neottege 9 BHT erloadin7 woe cn Add +735 ping -epecetor averloada _ SH} agi { Strng = Stet + otros The general syntax of aperater averloadh = | veturn— ty pe epengton operqtorssymba) | = (ne axgqun Langues er [Taperatore HH — Jlope reps ov erlo aating-funeFion baly ig i aa i cat eel over load _feinctien Ws a fs a =| the Pre ope renin ote Oe send gunghon Te eee uncon! or a erend Lunchon " __[*rneraber i ae ot feed o i ee ppe ue can SS “— | 5 Fue operator unctien Is a member nection ae Fab To te Zaves No Ow ument fer ana one re Faved Oo one argument for bina 3e4 & operator overload tng tnata uimen = nee eee SE (Twas operator oyerloading: 1 he eyntex for Ua x e | r= i iS Taror overloadin = —__ | wetura type operettyr sneny open g Hunacy eperatyr oto gee = rea 19_ AMY ton pe A Shi ei ——— o ebyect cn aE _—— Sheree pee a te | Mar Opteron Z | pas “una a’ 25%; Tpre-unary call Pe +> call es Os Pd dverloadl pre-una operator ay SP ng she concept of ope FP OveMOagG Puri. veal Japeil) — 5 i t ” Coutée"' Enter tye valucaft alec Cn >Saq pes eral, ; “a Ape rodgn sal) Jura ope verte ave “. at S: ee vi | Var kg Y I Cp- at | Coote cl The val ue ope Ts!) ceed Zee) gy _ a ee Ie et it ei se es Y ikon - AS Sn pul): t+) pa. digptayc) poe ‘3 — Oot put ° Enter — OE voalag = Dlwre Aw oveload post Ungoy opergior 7 — I pie te cone ep of operate cverleactieg TA clude ctogtreamp ust ng namespace gta, Glass tect | pavates ¥ = dng | a 0dng | pubn * aicazia Vad In pot) | s | Coot > wm % a 2 = Lae ¥ OSE] a perotor FCN) == $ : m~ ne & Il bsdy #0 erqtpr __ fj 4 Gepekat hawt ma, a vail als doy 3 a bats qee end T * TOE ZL he Vale of & ral Zeqce end 2 Volue =1S° ses Overieag una piel ris 7" re Mn Co ve Elz gO - we neept of es Pre-o perartoe arerlendi Be include Using Nametpace steal; ela. over * public: "fate; ‘paiva te: yor Tnputt J : - I Coutten Ente rthe value of c' tend g And> 2 : - 2, i on I= Fa operator — a c | 4 a aispar 1 Vv — e = ie ae cial Zac Keen ff wreflme WM =e ae 4 int me nO) — | $ | over Oa) _ 1 oa: Inport y | Fro oa. displayl veturnlo)? Sy ~ ope rattan quenodlfrgy : eas SOG Laagtrea wi Asin Namespace. gral: is Clase over pubic’ Tat eS Rua i veld on putt) Coote chenk ir the YaQjue of on az onl | Cn DSc Set ER RIE A RIE x ote f f/f 1 Void cpecator — yt) = — trails: I “ara Bal cficplayc) i aaa value. of c ae + y | 4 a _————J ot face a he: | [Ri wot O —T dt | Over O1- 01. Snpow); ] O14 > Tl O41. asPlouc)» re turn Cost — | a Date: ia he — TO ve yin aqualue &n unary Op eM@tor puer loc! Pro, WE CLG =a! retime @: wockde Ziostteamas “ping namespace Std; alagy best L piua te: Sint count ublic! Val fn putt) $ Cott gail éniey Fhe uglue eft Couns e Lend}. ePnsdcaut oa ty Ee3t Opehy dor +¥) Jlurar op: overload v Warretirng oral +44 1+ tt. cacind = coun+ th Setuecn ( AS) + aay ‘ak Ce Tne value Of Coun Silecion 4 > nom: i y t Y i fe operator —( Foad 1) y T load 11; . | \ire Aum -= num®L ob, + i 1 5 i. | % yetum (aes) 5 i, i Vad lisplayl) f | $ we € aglcc ne . | oot <él The volue at Num de \ fee eg ee 7 r 1% =; Le Lae = IL. Grout); == i 12-8apor rat achat 7 Tiiar powionely el ee ee ee ~ v4 ps or Oater f / “Cn © Hye alae eff how U Cutler the valuw of nom The value of om “1g AD S OPE AD“ overload Gin arg 40 operator 4+. find te. pe pA of dat member of nee’ object: | TRE ncluole. 2406 frog WD ——~Justng namespace stds 1g ielass bin. public» Sak %;5 phoate:. veld Pa pot) coutaal'Enten the Pvadue of % Neng) Ansy>e ; 4 ord operator + Gain _b) & . bn by bie Roag= MM {Sov 9L.4 Ceturn Vos) | 4 ee al Shes ploy ye J Cooked 'Me value ef V FllecOoon ezerdl, i Gat medial) Bin tsi 62 143; bl in oH) 62 ein putt as Ne turn ‘ Uy AP _*D_add ae ais; patie ob Anne obeok caclig ea Neel Mo Ru oe C 8 OF NeqGhingd (add) Aco © : | 7 5 Cw) Sg [buy ow rloaaling Eisen Sa! _eperaton Hincludle clactreanis \ [WiSing no mexpace sid: ele) ned _ st z | pavaces | Sat hy mini Gec: public: I vda_ apy) | ¥ ————. | | coutesienier he valli of hour wag Kk | & cqecond"<< endl, i b. | i QSShr>d miiy ~Ssec: a | - ———___ == -tysus rarer ov hy | Dork —2 295 B35 Reta sia! y - - “Be ch — +(dmer gee ——+- Waal Etrex on mp: object | ED .geonnee D5 cer ta. See | sain = cans bd ao 4 “ec LO 4 £@. See of 66° . £3. mya hye ti he 45 asin Ko: - eS Bin = 43 min e%6 Lo: | VE turn (13): = a eet > Ste “han 83° Utero eae Gre, By VR Aicpet) Swatazigen eae Inch name BR pave sich, oom pore - prvatet aan ee

You might also like