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

OOPs MU Notes

MCA Notes

Uploaded by

Aditya Kanojia
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)
57 views

OOPs MU Notes

MCA Notes

Uploaded by

Aditya Kanojia
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/ 104
[xplaia tre feabuaes of 009 ovguu Qe (hare benistic, Cosceot, |_csiaci puts) [pesenstoaed phage ning (2902 como N —_————0ep_i5 _0__pangaawaming are. did ot dna tne concept of “ohiests” uisn aay Contain dateia tue fr of Netds offen Korg as attributes. aad code ia tee BY. a proce duses . often Maeda es 1ebndi at Many of te tosh sidely used pogo aming dang uage (Sule 95 2+ obi a. Astron stoop to 2 sneahery o¥ feces dostee Ma3 tic of 2-04 my GQ) Obiget’ fa abitet is _on inctouce of = ch Asmoty Spuco ics allocates Uuewrit is create, obiect belong bo omy one cla = + llobiects age tre bacic yuu -time oatities {a ea obitet~ omented ushet Bx - 19 twene ove tuo obieots “Custonen” ond “aeeoung”. ted tine _custen@s obiect tay need 0 message to Cue accom object vequesring foy the lw ulagce. “Thus toch obiech Contudus dato aad Cele bo__vioapulate the date class ae class is & contaiaes nich Collection of _vemiabfes and __ |-retnods ee Meroty. spec® is wot alfecated., wnen it is created. ++ lacs tee stony, _obigebs, ee + |iclasses ove uses define dato tye - = _ [We _suatak Oy dorinia: lacs ig: oe Se —fss_ellass = aan, — 4 a Xe a ee up subation’ ————~] Eacapsudation is captur iad dite ad — Weeping ib A sncurely So ourside in bor faces ——— cou, i + lb, ranaing ue of dos nad Snerians (ato a Siagte vat Med a% ig Maoya etcopsudat ian + [re date i6 aot ible bo pre ubsige owdd, ond onty tose Sunetio a! Winn oye uneppeh ia tne _clucs cow Cc jon : Abstracting ‘eens po tue oct of ie; station Ceatuses uitvoul inedusiag ime taclevouad deta! e xptanahinn + llctusses use tne conteph ot anctunctoa ond ase deflagd os Hist of afact mach abyipubes Sueln as cige , weigut oud couse. _| onS Sinckions to operate a tuese ath cinub + lire ebidity bo sepnecean dana en vssg) Consephual deved | vinvoul omy Sebi -|lpata obehsoction is tuat ia uics A uses cas ery of te date on) netind ram bug clus Vitus Knowing ahowh uma _bwis is cteared WY) awositasce Anuevituace ic tue process bu lute obsiey 0) ame ass _Ocquise bue pop ext! of obiccbrs Of anatuen 60a: = \l4a oops, te concept ot imweritevice mpovides tue idea of | usability, Tig weag¢e thas we cas add odditiovol Seatune eo visting dace uitmous moditying it . ic ig possipts by dewiviag 5 maui tee fs bug, otisking ont, Te ao.) ctas iOt way on bined Saten of boty I tee classes = = FDaaescr pias’: . = Polymeric ic inne imemtunt oops conceph 4 Mths odtiby he — butte. a == _—=S—SOem a Aa palo eWina On operctinn —\cuy sont _dieereat _bawavier—(n Alerene iMstances. “The benevios depends _upe_tue, type of _dste uged ig tue operation « lne_grocess of rearing on opetaton bo _svesi__diffesent _belea nt la _dieseut incheuca ts called, ac _opeinto® _ovesdoadint ___|l sugpost opevatet wventoading, On uname, bindings e Binding eens ta tne ining of a_pate. dust at to tue code to ne erecubed ia espouse bo tne cal, —__ «llounaie sinding eane tat te code associated itn ¢ gives. qroceduse Cott {¢ not Miosa untie tue tine of tue, Caf _at_Steon | bivae. CV | Message Basen _ Oops canicke of 9 Sek et _abitats tuat _¢ea-usicate pin, eocu buen. : eSso9 2 passisd tavalves BaMowing steps’ — fey) Creoting classes thet detine objects oad tueis béneviont = || oneating oblects from _ctncs definitions aad (S21 lEstabiching, Communication emo obieats, 7 —— + || mevage Sh» oa object i¢ o mequest fox executom of _a. procedue A tresefose wil? inwoe a yet ia te ve ceiving pbitnt fret generates tue decived vesult Eye ‘ : 4+ Tuctily vow crt i cet (io eo tne developes ay Dennis (io crt caus devetnged Ir Biowng {Riteuie uehuiees 1464 ong 404. |ctyauctuap ia 4444 ity cree | lot Ark T elle seine medecessus ~ ¢ witts clorgcec’” GOT wuen pabea to crt i iin) ett ic a cupenses Of co, | inet of cs (62M eoatot tun prs code. (i> cat non ost of o06. (iv Ho suppost pancedusod “panen Ct) Suapoets tots pracedics pPewadsqet tix —cade deuatepient Lond nop pasadigec' tuesofone st is ofa cabteh a Wynsid | Oonguage (le _gatsa’: support 009 tuesgow 1c) +. A vise|_ ir Was wo support Sax pads tite Geing ow emgunge ct wrorpuicn Oca pul atlan and ppDsee br rb | inne xitenee, acapsulation ona ime dtigance | Vota 0, date ove yrg smbitiog and |Win ta cet, Bwempsutation Wise | eo be Aenipubates im oubsize | tue dito to pnuse wet cabal bt, Tait is becouse. 40h. | srtuctuse oy operates ox os i jon wii intended. Ctl get sol pega citing At being o ie is onl tr {s O Simetion dniven A aQuage, {oviect dsiven fonguage, __ | CXC does wot _cuppott Suction vid c++ suppost boty Runct/al 4 ofesatas aves doading nad opcratos qertooding ‘ Mor omespace |) cet uses NAMESPACE ysuictl lhe sees nob olfow uactions to 4) to CHt Cuattions coy bo xin ro ory fox eat 3 virtual endl peal ond Sens Su yet fon iend Sunurions | —_ Date : a | ee pe dotswe Suppask xelexeace fi) co t+ Suppests welese nce Nasiahte vant ables cdots aur provide divecr suppost — [(wiii) crt vide Sungate Soy {Sos extos rendding ¢ oso called, | won exceptiaa wmdling Excetion — exceptioa Vending’) axe used fo» " pass” erpsess breath whe te code incovetct » [md _pbiect oxieabed Progra opening Dasodiges fade teste Rav | Parodsigure’s Ht Posodiaac 1 wou of oded bo night oy f [ecutunte cot aguas + | sees ‘ a lqeas j a | Acapticit paxstigen | eg. 290 | lass pond i 2) | Fmerionel Poradigess (5) | pracadured Paradigen 4? | orient oslenteh Porodidas. oo ‘ ja Ng eag — C puted modular eee ja _paocebunal para did Por Qaldous Top dawn _approac + |Po0 dots nok wave. a cpecitien. . Ee ne a i Pop is mot so easty, - | poe gans nt pane aa, pe oping an tnidiag data. Se ik ic fess Secure. laa pa pitoating is svt pecs ple lant _puieated panedsQe\t. —— loo¢ Folorss —felitima up—agpieacn [email protected] tselade iat ed pubtic. Psivate Paovected th loop tas access —cpecs8iens Ae —————"}p.p——fieovide _on_2assy ata — = fo_ads— “edits ond Savetion —] + lleog gnaiides ata Hiding, So provides —etoxe—_Sosutt-————— + [ha oop ovestouding ic —pacelled - [Benes oft ort, Sava VG ur ct NET. 4xO.0. [visi Swok Mote _on Namespaces ia ct Ans’, Il Namecaace’: 2 A nenesquet, sefinition begins uitn tine tt siodd wmnesquce M0Poued by tne aoméeSpus not Rol fo ais. Monespuce — Anmecgue és met z licote deddagatlon : _ « liemecpore ico coutatuee Gor _IdenfiDiere tt “put 7° pat oR vine embeds Im somsiginy space So Celt they dan'e conflict alte mse nen ote ecpace °% _gPabel ue espace « llnemespuce is 0 Seatuce added in ett ong nov pe sent ihe, - |b in _purpace of _uciag vemespace {¢ to prevent awabiguiby twat actus Wes tin identifies Weve seme now For Exanplle 7 —s 7 - __ UAE Space ape. 7 £ 7 : ine_o! : int sue Cint x, int? _ é one _ zlivinike a Svort ote, au Qate “Tyoes ia les Tapes | A_daty tupe deter esincs tue. tua ae a tue date C++ qmavises vatiaus date tyeet and earn data typhi £6 dibPereny co, ty tious date ty paavised yy ett ase ules tq date fyges, desed dato tyeec wah uern-defined date type: f . Ore toasseage| 2 | Dewives | Built -ia uses patined | to iy Date Twoes Duke Type: Azuay + Speucture + U¥umetion + Uuion + Iipoi nner + clus: + | Detexence + Enunenation j | Awted x00. lois FRooting Z ue lupe TT ine Tones stoct| — ldawee | Wierasemy of ott data tupe: E cy) ile in date tues! : The _besie dato types provides integ yo), Woating gsivt - and _vaid date tyoe Asant trese date tue tue integral ond Mastlag_ + pvine dats} itanes cam be seceded by Seugrot bye —odifiev, by ott ave leis ase cre Key woess treat alpen _Ciewex _Siz@_om_ ey onde ox bop» ot the data types \Tre various modifiens axe suant, fong_. siqued and wacigaod. [1agegyal Pate Type” = Te, intearod datatype is used to Stowe — inbegers anh includes cus Cenasactes) ond ine Cinceges? data Dune: (2 Cuma ‘. Causeceess vehex $0 tne alpia bes, nuiyes yh other ounyo chess (sues @ 4 etc) detines in Che ASEM cuasacter b “ie__cuas dote type ecuples 1 byte of aewaotsys | tne wote andy pmenrouraptes at a time (v2 dat = faq _o++ 6 _intedata typ is used to Stowe inbegess suc maa, Sb5% gt, = ba5. At canaat Stone muambess sug os fr =60 153 “Gp _iat dato type occupies 1 byte of memeasy, (ii? | Fooating . paint Dato Type" ‘ ee A Moabing + paint _dato tyne % used fo sume dead Mumbons Sum as 448 6h ESTEE 8 91 20.55 Tinig data type includes Moot 994 double data type a7 || Foot! = a Tie Moat Auta type —accupies & Lyso of tajoyy, (2 doureer BE : Tre double data tyne occupies # byte of ae or : laid» iS a |___“he void data tuspe is used fom specituing be O49 rapt i _lposarietes tist too Aunction od 4etusn type fo | Ranction ae Stipa SE Esa ak rae ao 1 [tz (wdicores tvet_o function does ob xetusn ony value, ; | C= | y Page Ib | ~ slew ois ao emany is affacatea ond ence ib aan Sho L ease oo. nm id comob be ee bo declare sca pbe —wanin ble, lMoweves jt can be uces 0 dectare deneric polutes - (1) __pexives dae tyes’. arae : Date types twat ute. deviled Panes tue, huidt-ia' date type ase Kaows at derived duta ty } = Hts dows desived date types provided by cit oe av Bencbto Betesences ans inter ! (2 [rons ; I : Aa amtay igo seh of e sata | fae tua asc yeMected ty by We gine wonge, = Hane pe pte rveats ia ctu OBE _sested ab Contig rows (ose oer onobner) io focation (i D_ || Busnes! one. z 4 tuations 0 quup of statements evan toge hue pesfena a tas: Eves ct+ piogaam War at feacs me Mactan » wutem tnd oP tue most trivia? programe coun dedine dition Brachiow! ee 2 (iii) || Reteveaces. . A sekexence ic a altegwative wae fay wrianed tk sehespyce, 1s ow digg ox 0 Vawianle ia 1 ptednon. (AY) I Poi wbex L : A pointes ic a yorinvle bvat com chose tue L Aero, oAAs0ss of onatury yuwiatQe. + loin new Moy) bo use tue remo dunanicoll, + Huite pe ede of panbens eno: b Pncabed ox + Bes oNocabed to tHe Variable it tia -bim@ , thug wknd } o. eLDiciend oe Date. Page. (8? [User + petines Date. “Tape: Qoovised by ctt olnsses » 4p SUCE Nosious usev~ detined dato types ove stoceuse , yaions . enmmetations oad __ ¥, Shytrrctse uyioa ont chass y Exuctuse ond umleq o%e CH Siquificane Seatuses of G++ language. Scvucture ows uvion _ pitoviag way to yup Sivaitan 08. Aissimidan data types vetes¥ed bo by a singe wee € A_ctass act 6 a template omicu de Mine tHe _dute aé Suactlans» ions Aa sot on used thal consicts 0% inteq-uad wnsten be lity dectae on enumesation Key aos Onun is used. jit Fon ekunpl@- Cons’aet tic _Shaterent num covntsy § US UN India, Cuine & i ft dectasing 09 Patan by fe 7 kL [lEvptata eo — sta H ibe “ — |__(si. Ite, ong coatyel Ctruutuge = fo nebines e le@of our oude bo Le executed woe bite owe —| + hes Bepear: by fein ouk prog sem ax uce Penps ___| jastead. s|lteop strurcuse of fied GeP otitive contnat stauctuve. Hens, oe tunes, metwoss fon Wile 96 do = suite di i econ tepeat sto 0 _paagnea, Luocp contnot | l | lise oop | Jou dpop Tso-wuite tere * C0 | awige peag L Tie wile toop is uses Yon wepetitive ere culos Gx | ME Stubeeents bused on toe Aiven condition L IIAP condition Qulds ten Contsot 4 nutes tue suile dpop | Ag -oxbibloa becomes taut tues duile noe ody ait? web LK eCUte A, _~ Sea teak ts # inctuse < pita Srabemeab + comsinud xxU) thyeoi. That asec faviedione erty four doop cas cael Sao svitew —ploorss? aakiAue:. wate used ino Poop tis Sbatews ea causes Py curser doop ibpsativg fo end bh pue dose _bnen moves. OA to pve weep Sree _ i an0-4 ll umat is uce o@ Constructor pnd Decinuctor * Exptula diferent i peuetoy it cuikante 210 exp0) fins! b> Constxuctins ade ne # jactute < conto n> class cea i ; int code! Static int Count + punbic: [ stab () {. Code = ++ Count ¢ } 4 — weid Suoacode C) = i { cout # include lL Aexoue x6 Sindorentad to aedesa gaasy: eacting L | Sumfaten } i tue nose Tsize tl: treet gl int __ceapie [x0 Bron gle of one Dimeasiowol a jnetusge ? o¥ £ Sum > Sumy tasy lit" 4% Coub << "Suey =" <¢ Sut geben xetusa of output" Emtes 0 aud bess 44 bt 2 3 44 44 15 Sum 2114 (2) | Multidimensional Anvays cAt allows rudkininensiomel aren fe Sivplesh Son of tue mudtidimencinust avndy i bao. dimencionnl asa: + Torro roy wove note bean ane disencion suen assays ult ose eran ant dimension ae capled Muttidimenciowo? —thrtaye! +4 tuo dimensional ovvau wil? weed 2 subrcexipt s_inderes_¢ ow es a iy 84 00a am Cort <2 +t ws (b04 has + a0 urs Le1Li + (phe) roe as _ wt < patos Coubec ait 5 einen DO’, | : 4 | Amnon __Obitcte “ = = — i fexons of Hetace Sut Vaxiahte 6 eobted artaus of abslc te _ concider" tue Satresing case pefinitian ss — lacs engtane 5 es brah ose of tHe tugs of cuss nore [40T! Stoat age’ | esti [vol gtdetec vais? : | vais put date iA): | ete tem tiie eagles {c+ uses- defined dota ty0e ond Com Le ued po cseate mmieorc trat xelate to diferent categori: Le pve emgQoure | bro caplts [ baptonen noses 131: i *! ¥ Wt gos Sexe nen C161: — eS I A plug womees 051: = Vso oh _Stsiase: wl A_setcio? fox of 49 omay is on o¥nay, Lok sesiay bo la i¢_wot__vxcomom ia parfye-neiing to use _¢4 osmou _of Sa oO eee eT w fs create on Sting vray of strings, 9 10 cvosoctes ammay is aan of me fete inder determining tue nominen || strings oad tue owe sigue inte ae eee sing including Eue wugy tesminotor,_ fLomar ope AWerent Mecese specifiers : Access, Saccitienss —— ___Ct' otess percibitity te contwal access bo class es bess 9 om 4 peciWews, Aece: ecitieys ass ied to axobect dato Tyom, misuse Tae Glens ia cts (1) ll Punoig Specitiess : Cuttin clues igen bene ond ang blemt cus bes) ov outside, of a clacc by omy fanerion py often alec s|l¥ou “con access qubti aba qempess ox fenctinn dinecty bey usiad dot apexatax ¢.7 (avseu opevatox -7 Witu pointer! i? NGs0t Specifier’. Probected chu mene ss ond Suncttoms com he Used ingide tke ate Panhectes wbmbess oad Qactiow wanct _b@ accessed yo ots classec dix ct Oy Risibionalfy protected acco pecities alfosc yews Punebion ond clacces ta access Meese due aaeun per: (3) and funciyn: Wobe Specifies". Private clas mewbess ows fu pions com be. esed pals incide af cle ond by friend tenebione ond cbocces + || rodity Pers en eds om Kuactton itn di esemt cess eeci sien class Perso v £ pul tina LinscbNopo Seria) Dechilane | tm dateotRixth) sobected e — a = tning _otone Number ; ——— - int soba: a poivate : a = = stvlug addy : lwyd_in vyones : ce Fox _clncsec deGout ec ecities (s private, The default _ceces, ecitien Soy unions oud cnsaats is pubele atte Gsieah Sanction { vinat is need ot fignd function — white 2 pogtona to iusteabe tee use of friend fuxctrom, __ Adventage nd disadvantage. = lowe of tee impoeta ut Friend Fonction ove of ime important concepts aS aap is date Yidiag. bs private ie 9 wosmevioes Ountion Condat oece bi x _pustectes date hur Sometines this vestsiction moy Saree pacdne es co _wsite gong omb comple cose! these ic tecvewisen buift ia __ct+ gasgrectsing to occess pnivate ox protects sete Prostate: | soe aber Sinebions “ais Ie done using oo frient Suactioa ast ond a Sfeiend clase Feign§ Funstlon in ott 19 « Suntion is defined as o Sviend Senction ten, tue priyote ond protected data ot a _cfasc caus. Ibe accessed using tne Suction oe plies Unows 0 qiven function is a friend function by tu use of we Men dloss friend. Fox occessima te dato, me declaration of a Sxiewd fyaction Suoue, ve ode inside, tue toda ot tue. class ( can be omysbese inside dass eitves iA private as public section) rextiag itu keyword — Rpiead. _ Osctenotion ot fxiens Suction in cet’ oss clos. moe 6nd Lemetton otuen type Tunetion vome Casguaencrs i | \ + : . — Ha oon teting tre thletd Moreton a6 a nenotel fa te atest inne ants of nine cass oC bend He tanh IS 6d Ht tetnitlon ~ T . Nee : ts dyno Sees Cosguede nb ssre ll : y 7 tw. ty@e_Noretlon Nowe Cong oon t (sD). £ ad . ether eos Newne cca cc #s8e | @twis Tunediow vecaure tk ig Sei fad-teseles Manne Evo mn ins i \ EN ERS St tantude Closhreom> USN Mewnesaee d _ stat lass Distance £ tao { int eter; ~ patie: Aiken tt) eeterco) Fe Ghitaé_int odd¥ive (Distance ?: | scing privat auto from tea: menwen Ronetiog int uid ft Distence D+ _ ub <<" Dictanee 2" «« afd Five (01; = xeturn 0% a Mistance : § Advantayes’ ao Aftos snasiag private ~ Clu: inkvemation by a “Mon “embe function [Provide adaitinant functianal'ty Seceiog ) ia tue clacs, 7 |Disaduentuges Trey aten _inveniced iio is I xing con ne declaxtd cngoulse Cia publi Hept_outciae tue cla Protected on pri vate “ey adj to te QQoba? wentespace, TTuey, don't bind _dynovaic atty., 202 || wnot ic opexaton oven foadiag* Ex Q A Tee Linesy openotox ikw a suibaple progxant eadag Siem ple sans é pn eraepoo te |Lmad ic nperater overloading” teplata uiibe eraaple leo) pe: inc operates. oventon — 6%. || How i tox aven@oos'ng pent ding tenbes fy ‘ag ws Sxiead Sunetlo f * QS HI nen penaton ovesloading Gaplaia dato cuaversio: essihte usiag apexctox avey easing Cusite ovy 2 data conversion) ~ sob foivat ic opetoten overloading * uy all opersbes cuanok be evestaad in ott [ Operates over Doadiag ' r Opernntos ovelonding is on mpastant cou ett Sts 9 tyee of ply mnerpliics in wien ag ep etota, is ovewoos co f Ais Ovettons opekatos ix uted to pestara orexotion ow uses. eth daba type. Fou example 't' oppvotor cus ne ovedendod bo pesfas odeiti woricus date tyes tine Wy iateges, Cexing ety J object ae oe String = = | v . ' Cout << Tuis is test trig + ovesfosdeA insestion operatox Exnsole. Tue. impubloubjaus operates << oad > o4e goed truaapl 2 apesabos ovestoadian PHis_atso usek the displayiag tre voles at sone, Pe eaREIOS cost con't be overQoased Lecauce eves Joust Henao couse - exious panda FEBS om ip is untactivs! | mat __ possible. Ft Resodubion ope sator ( JLoniect sire _opevates_Csireot) —— Meribes access ob Mob_openetor (-) Meoises _paintes _seectos (*) —— | Temery 0 Condition? oe xatow {2:9 Spewtor _overlondint _synter, Weare OPERATES WE OVERVSTS —\y ra “xeturn_tyee clos acne !: optre tor op Cons, Ost) f \finerioa body : 4 . Anplearenbing opesatos — ovesloud ing. '- y _____Opanciton_oyesdaadins canbe _ sore by implementing 0 function Wii Cem Ioffe |_Meaves Fasetion. = Noa membes Fuvction Faiend Fusetion, sea = 7 operates ovestoading Mucho Cam be 0 men bes Sursction (P tHe Loft opesond is om object of thot cass buc if tue Lete operands is giRevent . tea _operaton ovedtoadiag Ginceion tush be a Ava: membes Qunebion, Oparacoy overoading Niachion tn be tage friend function? ia_weedc access bo tue puwate ond prabectes members Actas, — thn Fe0p iad ose sone, wecbyiations bo he Keps in mins MG ingle menting ypera tor \ OO | Dato Oxecedence e8¢ corre and Associativity a? on operas Comat be cuanted Axiby ¢ wun yees of opesands) counot be changed. UMard aperne fe. inal i b ——_1 opegators ce: an isty Ine. ovewtoad@s. tierra sedeCue we weaning of a procedure fev _conaet enle wos _Labegess ose added exoad Cinasy Opexatoy ucivd Friend Funchio 4 tincduae <(oseseon. | Class de so £ | ink 9 i pubic ang | £ e204 — 204 ee & | deed Cink o iabh ? a me o' Ye bi & 3 fxiend demo operates + (demo £41, demo 442) fs 4 berna_d) a | od

You might also like