You are on page 1of 62
Object Oviented Trogramming Using Crt Difference —_belween _ Trotedure Oriented Sang = object Oriented Senguaye. oa “yt and don). Procedure Oriented Lang. [object Oriented Language (i). Trogram is divided “nko (4) Troytam is divided —fato Small_farts Called funckons | mall —_parts (allel objec, i) St_Aollows —toh- down (i) St follows ottorn= ub Sie ee ee a “(ii:). “Shere ore mo axes (iii: re 3 alless sok iti Sbedfior pri i bratectory AS. easy Ton_is not easy” ty) St is dss Secure ok mo | (v:)_ Data _Fidfny isan | Hibs vay of hiding the a ae feature of [55 | ering le sll eda { canted \rogramning programming (iv) Adding nun data and (iv) ae noo data and. i more. (i), Ht ‘is more oe ee 1 4 t milan then dake i = T tsiits) qh is hurd o a (itt) Ais bard on unre oe entities. Mihi | entitits.. + were ) ot i 1 t s wed for dnstening 2 (ik ix) fom) xu a ts) ae cei jit . _ Ange and y (4) hr cant =— rane ha ale (x) Far cal La Fortran heal ak Tava. python, awe fey ee eee ; : i 4 ‘a >of —ore__bsic_Suntime eis nan ob _ ______ovientrd Syston th a__person han account. a ice Bie dda ap Can__also. a Classes_+ — Classis a wer defined deta pe which hase Some _abtribules whose value “thet a of itt oan oe ee ae te ass. te be dada toe oh 3p (a) Til => Thist are ae took _are accessible drone oubside te class to furryon {a ie F 4 Poltdhed 2 Ah § Ae ae “cca na won who (an + ati tt Hijet & flies i iL _(c\_| vi a: ris ‘Wee evel idle op only pom _uithin the class 4 Features of Object Oritnled froyramminy Jor Cyt (a) Geln Abstraction ‘ i —> 4 isan ack of orebresentiny essential Peahures without including background dekai\ for _exblanakion (b)i Dobe Eniahsulatin ote 2 ies th tte) =I Wah bing. ub of ‘deta and function into jot Single Leg unit is known uw Encapsulation . She dota is. 7k “acessible to he —oubside—tworld and _only those _funchons_ Anat ore rahe inte class _C@n_actt ss 4 (c) SIahuitanct— ae zs 4 is_o by which objects cf one class acquire __ piober ly jMiemtinabonather aiclass 4 ee eazy or famhle z= child class ‘inherits Seatures a arent class. {ae} Polymorphism wu TR ei | —>, For_examble t=" + Plus obtrator (+) ; Niet A =<80 . OS Sales ce alleen oie. “yy7 abc” be exewded in —_atshonse tothe Call. St _ means that the Loe pa eens iver, Procedure Call snot Brow until the i mnt (K)Hessage Ginding nuit od ‘i ae =>, dn object oriented program Consist cf a See _ ef objects. wa | (ey. Dynamic__Bind'ing LAhet Communicate with tach other. A message typ Ln objec sg deepest for extuuion a I procedure and turcfove We will Call a funchon, Lin the oectiving objec thet generals. desired, dsull . . a Sa Applications of object Orimed programming fo set tre (Ae bint) lee etal class Objk- Orimted int Server cdystems provide athe IT tntrastucturt , Creating. objett = oriemted client = trv internsk (051) ah\\icakions.. Here, infrostucure—urrfers +o Obtrating Systems, audhworks amd Hardware Osc Consist ok three mejor technologies (i) The —clien} Server wsinegth apes td cael tee (ii) Object = Oriented _Frogramminy (ir)h the Inbevnech cele le (»)_ Object =the “ida wr ey | —_ Shey are 10. Database Hu ma System Socal “te iene inet tll ata, duh a | deal numbers ond —_Inbtgers_. —_ objets Consist of the allowing = (i) -Miribubes > athibubes—anc_daka shel define the halts In ana tor Yuim.b a orebeence tn @ Comblor objec {ii})__Hethod s_ —> “They — define the behaviour tated Function or A (©) Bak Hime Spin Design Sal ek Inherent Conaplaxities the male Silla il 4 ° ont : igut i "FE retdetahtanmapoxt caustic olfedadnssaltal ality t 4 analysis and od. sapiens. be \| 7 (a) o Modelling a Complex tins ts quite dif frat ©] paeai cand Aybirmdig > Aybehat ts aimilar to ony aiylat_tak ut a | te hybortod and hybormedia . Simubation — and modding Systtm # Owing to the varying dprifications of the variable | duc typis ¢ Syskim sare preval tnt: In medictng and in othtr areas of nahiral dente LiKe + Zorloyy, ecology, and ar sonomic. ystims . Sin » Gomblex Systems —uneyires modding and __undeesh ‘Antattions _exblicy — objec oriented _ proj rammi provi an aldanev cpa ory hese Combo moddliny —Aystins de> = Es Stored, —deavched and edit east ly I Hy raed, onthe oth hand is 4 duper it ger beh OOP also hilps in Laying tre fremeicar — (8). Office _Avfomedion Syshms = “hos Me formal oa tull as a Cormunication fp and outside the mney Some examples yg AT Dex peiisyctimea | Shhese. cr exhort dys. St han Jollowing — characttrstics :— (e) 4, Sts. oelable (ii) st amv = (it), Understand ab tc (iv), High berformen ce hb) CIM {CAD | CAH Systm s oor . ea be ; se in ay a abWicakions a_i a We to Lod cst rts —‘involucl 2 For instante, St —Can_be aed “while ¢ hedging shi and flowcharts. So, it makes tt _hossible +o these Slowcharts rs dn blue promt or a QS Write a bropram | 5 variables and lala — or la dus} Troyram = class studnt ‘int Sint Hindi; int Science ; int Soridl_ scinnce ; int Total_ marks 5 Alok bercentage 6 ss Reswht () ‘= i | maths = Fo 5 Hindi + Science Be Social. Sciences Percentage = Totel_ marks [si Lak 5 tut main () { Student Lalit 5 elit Result () 5 5 lo Ne du). ak | Class — Project al | private ¢ ; \ = ! hart 55 | #loak Float St (| public é I Sink Tubrut() 1 Sje= #*+) } loo; a 1005 nt main () t Project Tl ‘ ied 4s — 4 i: esis ner lest) cc. iy fie. te 5 | Masta $rojram on Ct —tnt—tow to caladehe ombound —— [ Interest ee ee dus). Program: x (eek 2 Project a i ee private: a ia Float b = ae ta Hoa = TL Hlodk t= oa Hloak (CT 5 Aublic 3 seit) al | ‘int mein () 4). To Ken. - ke “aid the Smallest ut Srojram 1s To Ken os Cre hen Keywords i iia eal Sf ai__tokens. aR, a a ti fal it ne a > Shey are cic — ays lesan — a ere ee ee a ; —__—__|_OMiny sty, fined clamen}s 7 ° 7; =s Gor exam} = Yoat , it, while, byiva' Prorecied class are Some Kequane ‘ a Shy ool ah she name of variables Sundtta Arrays. b th programm | ‘mC | pv J ay _User= defined Basic Dato, Derive Det Dt Aypes tubes { { = | Stati a i Fa 4 _ Union, DT Acray Class Moat re q { ation it double ror. = MAMer at a ! (9) Avay — tn arvay isa collection of Similar ye oh A Stems dnd tach _eltrment_ 3s Called ain element oe te ara She dda type of the tlments ray be any vali aren type Mike char, “int ov Moat oo = Gor example = if we Adfine an_avray of Size 100. 44 canbe done Ske int 4 Foo} 5 dow hei She sea _c\oments a chill are 7 apy, we 0. (7 ead Bc Bealls a (»),-Gmction > > A function iso bi at_of let ffs—a_lain and oreduns a Value func jon_is_a_AN\f Cork | sSub-_bropram —_which —_ts__mem+ todo _ifome sd fl _Ahined task AC program onsisls cf one ova Audion. Sf program had onl ont function} rut [ee main () function too tybes cf Junctions —— (3, Library function Les- fein), Seanf()) (ii: User - calglinal Junction L (). Binks. md ff =A sh tex Ts a Vaviabh that Jaatmory addvess Ot i , al cd inte ‘ seit bomnts_. to bavi! g 5 eine ‘in_mumory by sahil thy address of thak __, docation She sie spl cf declaration ae * bointtr -name 5 £ | oe int_™ iphe aii i fsa pointer that whould boint_ to a varrab ll a we : ontans the addr nt 7. = vatabl rm Te eae “Ae = Regie (| Struches —» —— if >|, Shuttures (also Caled stutts) are & ian’ ah + Serial — elated — variables Tato ont ea Each vail {Sethe —atudune 4s Kroon ak mem ber oF > Shuchrt. a el >) Unlike _an array , _a__Shuchure__(an (onluin _m any «diferent debe ty)es (Like nt, String, Chor, etc.) i ded r Lu . 3 (| thim 9ea A _Union tsa User defined —_tybe sin. tah all —— rmbers ghar. the dome mtmary docaion = FA Union Can font riot more thon One objet | From its disk ot rnembers i = S_ mens thet ro matter how mary mm Union has, “it always uses only eno memory _ | Atore the Largest rum dev | cles > a > A_class is simply a __aebrestntation of a tube af peice iss (ai t an zoel 1 that deswribes the delat ls object. Cassis ostd of three things. 4 name, of ‘bute and obtratio 4 _ For Example — Stud objec Studtnt = new Aerk numeration —> _ =e ogramminy!. enum 0 mevation —_{s data ty onsisting of -vramed { QP em ob 1h de bresen ateqral Constants | brovides a Alf i | 4t also makes the Code tasy__to maintain and Sess Complex. ) \ (we) fat a TENTS —> I dtores integers (tohole rumbers) witnouk — decimals —>|| For txambl = ase thie (+), char_ 2 . > 4t stores single characters — and thor. veut ; Surrounded by Single ‘RT fat sel ans a = For__xampl = ‘a? or lg (i). Anat > — 94 halls oneal caine hin ina points. - > For aah = 333, ov 33: (k If double > => 4 stores Hoaking point abe > For_ofamble = 19-91 or = 19-99. _(L) oid 3 =a ‘is_a__oieturn Pr dike ek tak char or, phic after Ki ox 7 9r ‘ial ie “Dhaates & q nh oftyater fs a Sym hale i —Nilue to _btform. _bpecific— Toate —— Loyicall _omudatfoms if Sane “Gt, TTT _butlt= J t-jn_oeralors — fn a, jie anya fun chio th An ~oflor — ofules the —obvnds-— —_——_| Fir sample = int Ge a) ae, 4? is tn_adlition oreo a? and £5? are the nds that are bet td. => Gt (ine obtrators ints “the Apllowin: ‘ groups: (a) rns re erator 2 (i) AssTentarnte Aol edtnvs Eee site Bit wise operators bd on Optrato 4, Unary obtrators : Lei Bice cif a ommon mathrmatical oberaton I ta irae ceca ea rfl reas 6 ate. =e) nema Gi 7, ysis Sie = dubhaction Tee? Ss wed for multi fication cithmet i ei “Kethindie whee are urd to perform Operator | Name | Deseviption ered iat | bea ab oi L. — eS ae mnt Hon | Ad&s -toyeth er two Values | x+y | =o Hermans | Subtraction | Subtradts one Value from atte aieher| oe | Zn Hult ication Hultiblies two vabucs [a ; i | | | Division | Divides ome value by another | 37 y [2% “| Modulus Returns toe division Sumaindiy 3 Yo 4 (8). Assignment Oferator wadh-2 anal — Assignment operators are wed to, aatign values to “variables . Gor _exambl + We we —th__utignmnm}-_obeielor (=) to _axign tae rarer as G warinhle allcdstioes Goede fb) _I| Sahota d = i ae niin tsetse C=) alka al a Nariable vi Bihwise oxclusive OR. Right hit AND Se Left ahift AND () Logical Oberator ° i = dosical ae are_wrd do a the. Soyic. Jehu variables or Vets —————— _[Sheretor | Geach macs ec Te “al AND Returns tue if both - | “Matemnts ave trac VL tof _on Rduens ur Hf one of the | Rime {tel NOT ise he sal 5 iclums © false 8 the stesult “is ! i= | sue. 4) ise ober Tet ha oftys are . o}trations on individual bits. . , be wed —_allonssi Vs Sota tybis . ‘ e ca Name eo ___Example a |g) ap Binary ain) ab i \ OR Binary OR a|b = b = oT. Binary One's ial : | en to! Sind out iP 5 4s greadkty than 3 + Sot che Oey, int iy = 35 (ow “<6 { xu YY /}_aehums 4 (tm) becaue 5 ‘s greattr than 3. Operator Name == Equal +o = Not equal Le rE > Greate han. | uty ng othe < Less than. = AXE yi z= Greater than or. 2= cya to : —— less than oy = tae equal to (8) Unory_ obrrators 2 |G) “Tntrement_obtratn Gi} Decrement _Obevato = _ Crt also provides ‘nomunt and Aecremmt oberators ‘++? and S--”” ones bechively (i) [-Tntremuntcahssahr (4 fmcreadts the value ef 4th obtrand by 4 Gi :), Deerermant Obtrator (== ade dy = For_chamble = ls siya ch 5 _ Sah — wm 5 InGroment Opcrato — Het, Ane tole Phun 5 “hata tu val of num 5 Me" hawt used he H+ and == obuahors a prefies Dike (4++4 ee > Hounyer Wen alia wie these operators da = postfix Mike (att and ey Oberatoy = Nam pelt | * — tL | ] _Desevi tion. _ £ Example r |Tarreewnt_| “Tmiveans, the value by ms a Dereon | Decreases aie Nalue by | shitt Operators _* ae >. E “1G a Le ago 8 iy i (ii-)_s! oy Sees She dete Abe obtetor —ahi}ts all bibs eal ba aie jy. “ a a of Lael qt fis deol by {<<” Gor_examble += One_bit Ie whit + 1010 Lil LL a i ar min — ve Leena cae em wm + ahitt obtratton , each indivi itis while aa oe ze bit As. Gq mace ad) nos} vis _Sistarded, while bh ht - b ma acqnt. this vatanty is aeblaced ka q ce i deer - ahibts wl a towards 4 m u b bits ave _orblaced= by Zevors’ (0). Gor exam ple te) Toni on ia a | 0.0 eae 000 1 P= tit, — Fach Sind Ete os ny) Conditional _Obtrator : ts re (onditional obrralor (also Known an the ternary opteator ) Can be ued to vueplace ifs else ‘in Certain Acenarios « - —> A Conditional obrator evaluates the. Aes Condition and, extastes a block of de based onthe stew of the {| fondition It's Byntax is 2= Condition 2 xhression + ¢xpresston 8 Het, Wondition is evaluated and, ——____ +b ondition is strut, sxpression-d is _t06¢ ay + And, if Condition ‘is Salse, expression = 2 is _exeuiked >. Gor example: a=5 5 i's bee = | cae aici) 2 cee [Condition 2exp d+ exh 2] oe ia Sac J OR, ‘8 a =F md b= 6 Ec oah ) ROS ae Cp te it nary — oberator _-ta btrand ondition , exbr ____) = sion and sion i the Conditional obrvato +) 4s also Known aa th nary oberata 2 Unik 4 + Tolymorphism- i - ore 4aXt__mon => Falymor phism means th tile a {One form. wad tw0_ tum. st — 4" operator ton add 7 — for a ths chur _ too _ushrings oe =} =>} Ssatlatly a Function with name _ wed 40 draw different —ahafes bier Of Po lunar phism < = st Gombile Time | Run Time Telymor phism | Polymorphism | X | vw 7 Sy B “Ganction | Operator virtual, __Jovrloading _| [Oueelaading 4unchons + Ganttion Overloading = fos Sh are Webi function th Same nam tmeans _funtHons oil) be having diPtermt definitt buk wit rela Pancho “(e)_vet sa sai mn baa 29. 4_—wsid sum Cn lat hit) i oid Sum I o Froyram = ( Function Overloading ) 4 ‘include Outbub i= Tru volure of Gylindey of —ondins 3 and aight 6 is tt. Tie Volume 4 Gabe 4 ide 3 is at ie Tha_dsuen_of 3 and 6 is_waing funchion with 4 _avyuments = ts is t \ fh | oat eg tu Volume ot bod of 3,4 and 6 is 426. hy Volume of Cylinder of vradius 3 and fright _6 isles is the Volume of Cube of Side 3 is at. 2 DB __Program 2 (operator ovnbaling.) wan 3 4 include < iashoam. 7 Class ee" ee nag —— Pid, Ba é ‘aks in >> ‘may; ae ees _omblex stem 5 Aemb. = p a tenn. imnay = ‘imag + obj imay-5 (ouk << es 7D 3 of Complox ear << oral << else ; Couk<< “ Qutbuk tombla uo + ?<< seal ‘image Ered g #_e ot tnt main (.) i : “ec Com}lex Comblex Li Complex 2, Susubk 5 Couk << Entor first Com}}ex no? \n” ; Compl 4. inl () 5 tia Couk_<< Enter Stiond complex mw + \0?? 5 Comblx 2. inpu (5 alll Jesult = Gmplex 1 + Complex a5 — He rsa Qutbuk () 5 a : acum 0: bs are eee they Nt oebers to hirvarchicl —ustuchure_of __dlasses to Mingle baie clad —G@n__ have musth IK a Tem othtr dubs classes Con. urther ‘imho thst _deviued _ __classts forming hierarchy of classes. — class wir. > Ws name ts Same on ame _ Ries ithe = + Stink : FF include ae Unit- 5? Constructor 3 Destructor TU Contos 1 i [ont is a She rarer « | aud ical ot time yt on 4 St sti an to. witlin—de data ant Lobjeds _goncally ane Class Stud 1d ae dow char nam: [io] doable fee; ublic = 1 Student () i ouk << “ kale 4 cin > wu!) no Couk < ce ram ‘thm ¢ "5 cin >> name: (Gleccenite ha? i za fe; j word display ( ) 45 . int main () i ae Student 5 5. dishlay () ae tibet eNO ae dale a sie tll I: | Desimdny 2 =. Veshucr 7 _Snvoke an_instence member function which ‘is = ais ot Ga Proqvana_: Ss ein de Class Test | aii oie I Test () t ze ; ae a ~ Test) l i © \n Destructor executed idee aealid a main () Tet +3 _-__— _—irturn 0 5 Lat die ‘i eg a => A_Caly onstudor isa Gonshnudor ef th —_——— classrame ( classname: 2) =. Sh. com}i) M1 Wyeth by —-Conshucto 4 ; ae, ————_| “th nt oF the a toothy instance membev hyo nav ber =the _Combiky wil) also ue +h Copy & tor Wwhencwer you Snitalize an ‘instance ny Vay. 4 fe Xam ty 5 =. Gor__exam phe = Studint_s' dFoutk — Gonshuctoy d i ATUatn op on rm d 1 u — Goby Constructor Ts cated hone: Qn Toshi F— dame _tybe is ausigned to annthey in fern ch rome class. 1 Se A _Coby _Gonshuctor _‘is__ not delined the _Combilve really creeks it and $k ie . o | Program 2 Cla shiden a ‘it_ ual no ; Sloat mavks 5 Tublic * i Shudent Cinta, float b) Soll mo = 4.5 marks = b ; Student (Shudint 45) i Joll_no = 5. sll no 4 marks = 5. marks $5.5 : } Oftonal, function | 7 | void _main() students usi(5, 48-5) 5 ahaa) } studant SUESTS {| studnt 53. = $4 5 ial 4 5 _ — + 4| Parameterized Constructor — A Gnshuclor have —_harameters or akquennints_ chenewion | be provided et th Hime _of Creating _an_ objec class — B_ Program: _ ieiarl. pele B _ Fr include class studint- ie ibouie Tublic_t } Shidint_(int_aa, “int bb = 100) vull no = aa; marks = bb 5 = k; ‘int_main(_) 2 A | Student 51 (io, Fo. oi a hide’ 2 (u\ 3 we» = QR Gh dae inch) } Jiduen Op Dyan _—itlzn foils - “3 \dhin the initialization takes Blace ak ua ime asked of tombile time, i _is (ated ___ D Srinclude tht — function arguments ane pared at address . the Clty function — pastes. the address Bethe pavometers tl — Pointy ate 4d Tn the function. debinstion under (ath by adds mdhed wi a o | Program a _aF include +— Moi intatmerbs (abu Vial A dah Li ball he ot ae ud lout << salayy ‘mcm +? << 5 es _ aS ‘main () = Crser() 5 te ‘int__Sal = 2 F000 5. avudiets dy, ‘incrernmt ( = Col Sc ae e — |S ; —) Gaclons in Get (an stchuen. —# Ieee as chin a pointy. . — When function archurns anefeeneFmeang Lt odurns a _implicit a woh ae eae tae brogremminy mot only yous (an. pass aby atherente to 4 Aunction — but You Canals, _aicturn 0. valur by efi ot | Rien by cacfarnce 1s a erent 1 by adm — Gunctons — behave _¢ Fal ee ay variable ov. peinlnrs a etek d Sint t= = sinc ~ data Ty} S__function Name (_paremel Where, — data Type isthe aichurn type - the _Junchip ) Dire tout << Fas ea << f oh adenss a Win? << - ~ Sb << ond; dieiiiecie yeti Value (9 a 13.5 Cout << “fa = » << a SSiuif* the dah: - da xx tnd; se ee Ce YeHin 805i seid wish 2 2 i wnat 3 a: a 4]. Dain SS i a7. define amdin function 3). Gunction_ Declaration aa. ll be de ch actual bed the co nian tata —asharahly. i tl at claration — ha j . me i teri mike list); > param cr . —gatinn gh in ot lag Ts a 10 7 eg rs ellowing is = ‘int ox _ (iat, “int_)-5- => Gunction — declaration i a Micon “in one sdourte File function in another Silt n t 1 St 4 ating the Sanction. figs) [leas ine eee duclarahon of the Aunction ‘a “i i program hou the . pt Of in nehurned D In rancho and toe twmber and ybe oF arguments, pee ne brototybe describ th runcnon 4 f > th om}i by 44vin Actas a Argument list — Gor _ example = Sn aR . He) ‘in 4 Jur n, Ty m th Dun th egury Hist Safse oa dus). To wee a function, You will have ho ca : ‘invoke that ptrson . ha } When a program calls ag dune fon, broyrom on iy tranthereed to the Called sasfunclinna ak i function breforms.. Acfined task ccand when he rehire sStohimenb ‘is__extuted or whtn ts fan ion = ending . Closing _ Curly braws is neached 4 te ms. brogram ono back tothe __main_ rogram oY z t,—and_ a unction urns” vollue hin you (an htore ia ay 7 | Titiee uncio i Mt =| Thin _fundfon sg function thet is expanded inline : inli when tts Called ahs ath inline function is alld hale Gde 8 the inline Aunctin gets inserted or __tubstituted ok the faint et inline 0 yd ons = an nt hrovided aa Pl di hat is auton atic aly xi r it 1 talling 0% doxsn’t provi de vol value. 4 Ane argumint oath this ne any, x is_| i the ar faut ee ce overridden. ; 2 ao i le pie |e Saleh tering ree au a eyes sume (ink x, ink y pai 2= 054 Sint w= —# i Stn ae w); re ‘nt _ yd () 77 hes oak << 3am (1518) cout << sum_(10, 18,25) < a % out < - ; octurn 0 5 ’ o = aca tht Saiki that for_(int i= 0; i< 53 itt) i (out << my Numbers ChJ<< “Yn? a cilia eg 1 ll yume i satlo 4. Const Orguments es tt _aiding _Gonst 4 your tybe ab __ | wayi ‘insu ‘is y _oviginal Valire ¢ Variable. >| Gor _examble 2= “#etncade _voik function (tons int _v=0) | 5 “ | y= | Gout << v << endl; atc ih | Le — a sisi) aad cae seedh-catiiae || Wath eRe ore \ —: out<< Xx << tnd ; __tunction Os 7 3 Tiehuy 5 7 Gre bn Grind mnxtion i Hal mee yiens 4 Se a nction — roe pai 4 The oe a ee aca : LAunctons int Tink Length ( 604-1). 4 b Qenyth_+ = lo; cum —b. Sensth 5 ‘int_main_() La HY Bo E Conk <<" Lg of box + << Trint Lingth(b) < Jiu 0.5 ¢ Unit - 3: turning. Objects = Program 4rindude a ri class Student 8 cigipidea | r 3 h Cou < “Enter marks of students? << end. 5. aoe marks: jadi Sa 35i8 aldmacks (54) 3 sa. dishlsy marks ()-5 sieturn 05 — | =a =f he fe i F [fae works Shit : Student #0 —} Enter — ‘int _cube_ rum () Me thie Be iy a slung sie alta $e void Ashley () sii spy t | & tuple Outpt = | lace wal ‘She Square of 3s 5 ds wid 5p ie aoe aha (whew Ghoy By TyddiG eadl L = = ee a ie al nae Unitr- 4 tT Su sohHen 0 erator Ct Eh >} 4¢ nm . te eet vesicle — when ther is a geal —} nae - = Frogram_ - ane a — SE ‘include < iostvam.h 2 Rt wr . 1) Glabal variable. 7 ‘nt nate + i / int x= lo; Variable | cout << & val 4 so STR it Xs i (out © value of inca Xe ie? 22K Vee , |” CC} (>) Synta) ae Acbevencin 1nd b = * ftr; —> For __examble = ‘int pty ve. <7 Prorat tee it Nigga lal cia Se AF ndude < toshtam 7. scheudoe stitutes void main () ere wes 9. ee = ___ iy oe = do, be =" souk : ‘nt ee 4 a _ couk << ra ate. where a __is_dtovrl ig 27K = = ptr << end 5 out << £* Ve a omer Pe ie I ‘ahh ~The addss where a —is_-stured js 2 Oxaf8eff #4 € ae Sh : pointer is + to. Stake Data ember funchon__ if (oby =n static debe member Only class “and | member ; a 3 as His __Jh b objec no atte i: ioe tes aw _ created initialized before any Ps of class — Creal 2 —8vtn_ before man : Sf eal al bintd outside clas: wen © te ti Aah. is =| oe = © c ( 18 Constructor Called B's Conshuctor Called B's Constructor Called Memory —tlenagement —oferalors alls ufo lah ayo Variable Or _an__arvay 7 Known ar diveck memory allocation —> We need to an. flab. ae sa allocates = Taxneory ty _ Yariah}e teed delete variable Ge adlocakes, memory fem variable 3 Prosvara =: Ti FE indude < tostream. h Noid main () PH a 2 inks { +— Gout _ s ine a = ahh i te ‘seit otal pac sw Couk << §* Student ” eles cin (pte eiaia out << \n Displaying GEA of Shu for_( int eh, Fsesmin 5. shi.) oa & Student ? << t+ 4 << 2 << - (prt) endl ; delete J He we I Saline hae - Student a +6 Manipulators > Manipulators are help shes functions in c++ thet are wird to molly the ‘input | output wtream . 2H will not ri the value “th a variable , will re modify the Streams twins y the “matction (<<) and” esyaction (es aires (a) a = sSbecial functions 4th Anduded Th ae _ktehemnt to able ae a ea (>). mee —ane__ofurator ee eed to. format the i Aare 1S play (c). to access —maribuledors_, she file ‘omanip.h”? | fiould he nude =o. ecafle ee (i) end "4h is sued The tnd A E. 9$nstead of aa tnd, Wwe (Can also: Say thot ut << * \n = vt | his will a Aare Mee ius ular ee ua Gi} Tntey ca ae ee ; = mar TH __will_disblay the data ‘in __hexadecrmal oY tkambl = _Couk << Hox 163 : PSK hex << 163 << \n?? 5 I i data i Gor _examble = Gout < SH wil St some amount of gl 4 for displaying the data or Seb the lt t $a word 2 for vsample = ble wads Gout << setw (10) < << “ Wor —_F a ne yas) gonis _ include By calling a Punction ene Can _ syn class — member con witthout bling wh with object in mamn__Class = Frogram Siamese + include AE include < Conio. h_& iL ee funcc) ccs cells nae 2 inh mun 5 void “get dale Gab n) iy tum = Ns __ aa void fuk data) _ wer Cout << © the rwmber is S) Le Local class obj 5 obj ._gek data (3) 5 put dete C), ri - | “wt main OQ. i me e Local felis 2.55 end 5 func() 5 Me 4+—_nedayn 0.5 ail wn Ses ee Wachee She rumb s+ Ft to _Hembry — Hall tobe Non- static chibers. ioe Ia objects . intr to member Lb ee iit et toa Static class member be caune Q. ae = a ae memby isnot _astoci wth bari object =| vam 3 | SF ieclude = tostreamn oy HE Sadude < Conia, ues | class «Xx sf tg I oid ‘mt : il Pa 2 ee Cout ee? aly ok : DERE z 5 55 int main () +: Neale past Strsees ae : blade ink Xt * a bt ip = Sx a a a) 2a void (x23 Ap Cit = 5 z X__Xobject capt i S Ghee a —X object. at ae I Court << 56 i527 << xcobjeck. ¥ ptiptr- I (ath ela led oda) gua 2 alae ES ») > Outhut ia jak zal Nalue of aig fo ~The value bis = ao HE include < fostream . ce AE include < Conta. h 2 = class» Virtual oo ——_— a 4 ia _ Fils ses eee void sal) Sane (ye { print ( prea a F a “void peint () = - Out put ss printing bare class ontents printing boxe Class Gntints, —_ ~ Const tember Findion_|-Gnsterk Findon = fundion —delend—ax tonite ty aga is fae he ni > Th Similar way , it an obj 1d. — a 4. Gnst Dima da) — ee? oe Deno dnp asl el — ff tow x * elie aggaalgnield Ss 4

You might also like