0% found this document useful (0 votes)
9 views9 pages

DocScanner 03-Aug-2024 2-00 PM

The document provides an overview of Object-Oriented Programming (OOP) concepts, including classes, objects, encapsulation, abstraction, inheritance, polymorphism, association, aggregation, and composition. It explains how these concepts work together to create structured and efficient code, emphasizing the importance of pointers and function overloading in programming. Examples are provided to illustrate each concept, demonstrating their practical application in coding.

Uploaded by

Bharath Raj
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)
9 views9 pages

DocScanner 03-Aug-2024 2-00 PM

The document provides an overview of Object-Oriented Programming (OOP) concepts, including classes, objects, encapsulation, abstraction, inheritance, polymorphism, association, aggregation, and composition. It explains how these concepts work together to create structured and efficient code, emphasizing the importance of pointers and function overloading in programming. Examples are provided to illustrate each concept, demonstrating their practical application in coding.

Uploaded by

Bharath Raj
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/ 9
| Fumento. COMCEPT OF OBJECT ORIENTED PROGRAM ! Object - Oniented progoramming Coop) -is O pangazamming peandlign Losec on te concep} af ' objects’. which can Contain data and meted, tat cperate on Re dato. Lene are Ye fundamental corepts oh cep : 4. CLASS : A clas is a bluepaint 0 template fom creating objects. iL dolines a set af almibuter and mefods that the objectg ceatd tron He claw con howe. €xample: clan con $3 could cleline otnzibuter I'he colon, model » and metods Mile Start ci, Spc). 2. OBJECT : oln objet is an Sutaxe of a clam - when a clom in defined , no memory .in allocated until an object ot Hat clam is created. Example: cox mycoa = new conc); creater an objet mycon af Re clan con. 3. ENVCAPSULA TIOny encopdulation ts He concept of wrapping the data | a =| cataibutes) and metRods Cfuntiov ) Hot oporate on Bo cata into a Single unit , an clas. zt aho cwortaicte chnect acc6en t Some wf an objec! ’s componente , which is a mean of pay enting unintondlecl Yntorterence and Misuse. awe controllesl trough acces medlifienn like pouvate , protected! and Public. 4. ABSTRACTION: olbstaacton Awolver Aiding He complex Fnplement tion detail ancl showing aly fRe emental foatiner | an object. «4 allows fecuring on what Yhe object does tutead af how if doer st, &xample: when you use 4 car you need tb know | how to dhive /t#,not how He engine woals infenally. 5 JMHERITANCE : Dhenitarce us a machoninm where one claw Child an subelom) Shhenite alributo, and meth from anothes claw Cparent on Supenclams ) it allous between Ae ponent and child clamor. Example: clam Clortuccan extend can $3 where eloctuccan nhenite ‘Re paopention and behowrounr aL con. 6. POLYMORPHISM: | polymozphism allews objects ok oliflenent clamer “bbe treated ar objeto of a common superclan . | rq abo allew9 method, to be do oliftercnt Rings | Fosecl on the objact if ts acting upon , even Rough Rey Shane Re game name. | Compile - time polymoaphiam C method overloacling ) : Same method name wrt different maname ton . Runtime polymooyphixm Cmetkod overloading ) : chibl clam redelinen a method of ro panents clam . Y. AOSOCTAT TON Aesociation 4» a 2elatonshin between tuo lamer. zt dlolinen how objacto al one claw ane connected to chjecte Gf anoke clan. Example: of can claw anol an Engine clam might be auounted with earch othen 8 AGGREGATION Aggregation is a spedal trom oh anon ton where ore Claw Can Contain 0 sefonencr to ann tbry, Lew but bo can enint Sndependen Hy . dt Lnepaasente a has-a' aelationship . leseample : A ibn claw might have a. afonnsep fo a book clam, but © book can Cxint Sadoperdinly af Re library. 9. ComPosTTron: composition is a ghnongen form vf aggzega.tion where We contained chert cannof exint ustthrrat He container. abject. it aepaenento a. “Poot. ef! aolatowhin. Example: A howe clay might Contam o. Som Chay, ul Pe heunre in destroyed , te Seem ws abe dertaoyed. mese Conepte trom the tundation ah cd and one used *%& clesign andl Jplernant comple. Sobtuane systems Hat one medular , ceupble and ony do moatntoig _ _ CONCERT OF POTTER Th ct : | A point in cH 4s a variable Pat Store Be | memory acldnen of anor variable. Instead. of holding a daect value, pointer holds te address where We | Value ws otoned. pointe anc Powerful Aecoune trey ‘allcwe you 4 work clarectly with memory, Petoam | dynamic memezy ollecation and. create complex data Stuuctnes he linked liste , tree ,ek,- KEY CONCEPTS: |oectanation : of Pointer is dleclarodl uring He * operator. ror example, nt * pt ; declaner a pointe ch an Shtepge | ef gperarer C4): he & operas us wed to get powcey addaey al a vanoble. ron example, Pkr = &van; amit Onn Pe address of var yo Per. | | : om dotelerencing qpaaion C+): The * operat > used fo acon fe . Value at fRe memoay adclow Stored un Re pointer . con example, * PH giver the value op tHe Vanoble Rot ptr Pointe to. ox pacgzarn © Finds “ Cubs E; in fhe volume of. 0 omnpe PLR ding using @ pointer # include ¢ioctncam hy wing rameypare Hd, ; sid main) t doukle side, volume ; | doukle ‘kr. 1 pointes to cloublo 4 ashing fon user Input Ceuk « * Erker He side lenght wp the ube :'3 ths Side ; 7 Pointer ches the adcroy of’ ele’ Pir &sicle; a Calculating volume wing the pointo, | volume = C* ber) * C* pry *C* per): 4 display te eoul} | cak <¢' The volume uf We cube uh +’ eet Oo: i CUIPUT : « volume ts endl ; Th you ents 3, te of uiill be: aries te Side lengli af to chbe :3 The volume of He cube wh +94 | FUNCTION OVERLOADTIVG: | amction overloarling in 0. deohine an crt that |atlows you 10 have multiple function with He Same name but difkercnt ponamerter lietg. the compiler Adorentates Here punction, based on te number, types , on Orden of te paramefans. H allen? you to multiple behauioun fon a function name boned on We orgumento pamed % st. | Keypointc Fs \Same name : All weloaded hunctony must hove the Same name. | Dilloxend pomametr: They munt Lier tn the type number 6% onder of Parameter. Reton type: Re ekin type CL He fureton connot be used to chistnowrh overlcocd, funchons. Example: | How's 41 an example whore He furdion add | 4 be ath 4 | ot add Cinta, Int bs int 0) sekan arbre; J double adol cclouble a. double b) £ oehon arb, | 3 ir! main C3 f cout & um af 3 and 4+’ ve add C324) & endl! couk <¢ 'Sum ef 1,2 and 3:’ ¢ Qdld 619,59 ££ ond: coud "Sum a 3.5 and 9.5: ° add ¢3.5,2.5) ¢2 endl! woken 6: | J (beplanaston | lel Cint a, int hy: Pin function toher hwo ynteges Oo parame fon ancl sete tein Sum. ade Cinta, b,c): Ha vewion oh add toker Pree Int and aotunn pho Sun. add Colauble a.by: His vemion of acld. tolean two doubles and eta Hen Sum. ‘ourpur- cum of 3 anol 4: ¥ bum of 1,2 and 3: & Sum of 35 and 9.5: 6

You might also like