100% found this document useful (3 votes)
6K views

OOPS Handwritten Notes

Uploaded by

pcuserant
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
100% found this document useful (3 votes)
6K views

OOPS Handwritten Notes

Uploaded by

pcuserant
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 10
ddccededddd dees vo \ veos \ AY 4 Sassyoob \ \ pe 4. [wahar ts 90 2] — OOP Is qbbveviared qs _Onject Orlented Programming Sys tn wntcn Programs are Considered Qs @ collection OF Obfers. Eath objer is nothing bur an Inctanu of @ Class. 2: [Wisite baste concerts of 00? 2] > Foilowstng are tne concepts OOP and are as Follows : 1. Abstraction 2. Encapsulation. 3. Innevitanw 4. Polymorphism: 3-| Whar isa class ? > A class is Simply 9 Fepresentation oF @ type OF Objet it ts the blue/Plan/ tempiare, tnar descxtbe tre duals oF Syn objet: AR CLINKED] as Neves Guecery Crecey 4.| winor ts an objenr2 =) Onseur Js teymed OS an Instgne of a Class, and tt has Its Own stare, behaviouy and fdentity. 5. | ponar is Encapsularton 2 > Enopsularton 1g an attribure of an object, and tt contains gi) data Nth is hidden. Thor nidden data can be yesretcred to the member OF that class+ Levels are Public, Prorected, Private, Internal and Protected Internal. | iAner ts Poiymorpnism 2 2 Foiymoxpnism Js notning but assigning behavior oy value in @ subclass to SomerhWing thar Was giveady declared in ene Main CIALS. LIMPIY, PolyMorPHism fous more LOLLUGECdC dee ee Cee eee rw” ? Inhwitane ts 9 concept woheve one Class shares the Structure And benavior defined In another class. If tnhevitanw applied On one class ig catled_cingte Inhevitanw,and i It depends on muttpie classes, then ttis called multiple Inhevitane. -Lainat_are Manipulators 2] Manipulators are tut funutons whlch can be used In Conjuufon With tne Insertlon and extyactton operators onan obser Examples ave endl and set - q.| Define a constyucror ? ? Construrroy 15 g method used to fnitlolize ta stare of an objec, and Tt get Invoked ar tne time of Objew creation - Rwes for ConspyYucroy are! howd be sqm oTes GALCeRY C TEC lo. | Define Destructor 2 ae aaa > Destruutor ts @ method Wen Ts quromarteatly called whin pee objer fe made of Scope OF Sestroyed. Destrutrure name fs also Same as class name bur with pu Hide Symbo) before pu name. e| Whar ts Initne functon 2 > Tntine Funuton ts Feehnique Used by tre Compilers and Insrrvucrs po Insert compiare body OF prt Fynutton whereever tar Funurton Ps used In pry Pregyam Sour (ode- 12 [raha i's virtua) Punaton | ~? \ixtuot Funuton ts @ member funutton of class and ‘its Functonaltty Can be Overridden In Irs cevived class: This Function can be Implemented by using a Keyword called virtual, and tt can be Swen during Function declaratfon- Virtual funurton can be achfeved tn Ctt and it can be Qthteved In C Language by using funution pointers or Pointers to Function Friend Funetton ts a Friend of q class phar !s qiowed to access 4o Public, Private, Prorecred, dara In thor same Class. I€ tne Function js defined outside tu Class cannot access suth Infoymarion- Friend an be declared any vohere in the class detlavarfon and t+ cannot be affetred by Qecess contro) KeyWords Ike Pxlvare , public of proteured u-[lAlhar Ts Funetton dverloasing 2 > Funulon overloading ts defined as a noymn function, bur ft has the @bility to Perform different tasks> It Qnows Creatton of sever methods with tre same name Ldnith Atefey From eath other by type oF Inpur and Ourpur OF the funutton. 15+ | har is Operator Overloading 2 > Operator Overloading ts 9 Function Where Arent operators aye applied and depends on pu Qiuments - Operator, —x can be used to PALS tNroUgh pe Functton, and ft nas tnely OWN Precedenu to execute o prucmumpr (LINKEDIN), MMassssooooboo00bLeddrtdc ed ddd dd edd’ x de ccc vutcedcedced 5 Bav_ve Vw. veOwvwvv vo vy 16. [von ar ts an abstract class > Ang Tate class Ps gq class Which cannot be tnstantlated. Creatton of an object 2s not possible wlth abstsaur class, bur tt can be Inherited: An abstraur class can contain Only Adstracr method: Java allows oniy abstraur Method tn qbstvat class wOnhle For Orney language tr allows non-ghstracr method g¢ Well. tlc a bernary operator? > Teynaiy Opevaroy ts sald fo be an Operaroy LOWch rakes THLE AAQUMents. AvQumenrs and yesults are OF SIFFOent Gara Hype, and It fe depends on th Funuton. Ténary Operatoy fs also called qs Condi Hono) opevaror » Arye fypite CUNK: 18./ lalnar V5 the use of Finalize menos 7 > Flnaitze merhod naps to Perform cleanup operations On the yesouvtes WHIth axe not cuyrentiy used: Finouize muthod 1s pyorered,and Yt Is qecessible only phrough tris class or by q derived class. 19.| rinak ave sPFerenr types of arguments? | 3 A parameter Is a uarlabte used during tre declavation of pu Funerton oF subyouttne and arguments ave passed 4o +m funuton , and tt snowd mareh colt pre Parameter defined> “Mere ave two types OF Avguments. © Call by value — Value Passed voll! get modteied only aaa Funurton and tt yerurns tne same value woharevey Iris Passed tt Into +ne Funcrion . ° Can by ReFerenk — value Passed WII! ger modified in hotmigide and Ourside tm funtttons and It yerurns try came or different Value. Atuc Kumar © FD Super kay word fe used to fnuoke overvidden method wren overrides one of Its Superclass methods. Tris Keywerd allows to acess overridden methods and also ro access Hfdaen members of pre soperelg ss. Tk also foraids 9 cal from q conshutroy to a wonstyuctor IN tre Superelass. ~ lwinar ts mrumed Oveeviaing 2 = eee j overriding, Ys a Foaruve tnor allows sub class 40 Proulde Implementarton oF a mutnod Mar fs alyeady Seftned In tre maln class. Ths potty overrides re Implementarion In me superclass by prowiding pre same MUNOd NAME, same ParAMeeY and same yatuYn type: hot fs an Interface 2 Ain YnterFaw Ys @ collection of abstract method- IF the Class impiementc an Ynheritanu , and phen Mereby Ynherits ol) te abstratr munods of an Jnrerfau. 23+] lAynat fe an exceptton nandiing 2 => Exuptton is an event tnar occurs during tre execution oF a Progyam + Exceptions can be of any type — Runtime exception, Exvor exceptons + Those exceprons are nandled properly through exce ptton handiino, mecnanicm Wika try, caren and throw Key words 2u-[inmar ate tokens 2 > Tekan Is yewgnized by 9 (ompitey and Ir cannot be broicen down Into compenent elements. Keyword ¢, tent efey| constanrs, String ilterale ana operaroys are exampresof qouans. Even punctuotion charaters are also tonsidered as yojans — Brackets, commas, graces and Faventheses, WOSSHMYKOLELLOLELEIECCCEE ee : bb SSS ‘we WSSSSSELELLLGLECEd Ed dee ee ee = = — 25-[DipFerence bjud overloading and Overriding 7 | 2s Overtoaping 2 OVERRIDING + Overloading Is starte binding. J» Overrfding is dynamic binding. + Overloading Vs norktng bur pra fo Overrviding Ts the same SAME meriod talen ait Fervent Method Name with same Arguments, and Tt mayor may] arguments and return not veturn the same vatue in | types ascoctares wlth reclass tra SAME class Ttsee. and {ts cnfid cies re [DsFevena Be ciaes ang en onjeer?] 2 OBsect CLASS © An objet ic an tnstang ofa fe Class don't have any Class obdjeus nold any information. informarion. @ Objet does not have © Class can have sub- classes. Sub - Obs Urs. 239+|Winar Ys an abstrarton 2 > Poctraction ts Q geod feature of OOP and St shows only Pe Necessary anralic to tre clfant ofan ebjers Means, Tr shows only necessary dutslls for an objet, nor the Ynney deralls of an objeur. Example — When you uank 40 Stottch On relenision ,!f net Necessary +0 snow ail tre funuttons of Tw. \narener ts vequlved to suttenh on Ty ott! be Showed by using abstyaer cigss. 2%-| har are Access moat ter? > Access moaiFler determine th scope oF tr muthod or variapies thar can be accessed from Orner varlous ober or classes. There are 5 types of access modiFlers, and they are Qs Follows ¢ © Private 2 eere * Publte » erlend © proceed Frlend. SS Ate _kualar Coed keo Note? Gacer¥ CTELE GRAM) ecceededed eee uvuoee } a) \ VOVYLVVOO 1) aaa y\ ‘ys yO Sy \ 29.[talnar Ts seated Modifters 2] > Sesied modifters ave the access modthfers neve St Cannot be Inhevfted by the methods: Cealed modifrers CAN alsO be appited to PropevHers, events and methods: Ts modifiey cannot be appiled to static members. 30.[How Can we call tha base method ufrhour creating an Ins tang 2 Ves, fF ¥s possible to call tee base method wlrhour Creating an Ynstana. And that method shoud be, startle maumod- Dotng Inhevitana from thar class.— use Base Keyword From derived class. Bie[winar Ys tra dleeerence b/w new and overvise? | 2 THe new modifler Instrucre tre compller to Use pra new IMpiementorlon Instead of tre base class funuton . lamerveas, Override modtfler haps to override the base class funuton. 52-[ Whar are tre Vavlous types OF Construcrors? | > TREre ave three varlous types of Constvuuers, and they are Qs Fonold im. Default Constructor—Lultn no pavamerers. * Favamaerste Constvuctey — Wlith Paramerers - Creare a new Instane of 4 class and also passing arguments simultaneously. ° Coey constyuuory — Which cyeares q new obsecrasq copy of an existng objet. 23. |ilnar Is early and hare binding ? 3 Early binding yeFers t0 F6signmenr OF Values to Uarlables during design me Wnhoreds tare bindin yefers to assignment of Values to variables during LIAIKEDINI)- Su [Wnor ts —tnis Polnter 2 | => THIS potntey vefers to the cudrent objet of a class IMIS Keyword Ts used usa poinrer Which asffFerentfares Barren she current objeer with the global Object. Bastealy , tt yerers tO Du curtent objent+ NF Povence b/w ‘tru an aes 5 s.[mnar te the ure anda class? | 2 Staucture CLASS eee ues © Stiucture default access tyre [> Class access type fs Ts Pulte erivare . © Struccure TS used for qyouping}® class can be Used Fo grouping dara. dara and methods © styucrures ave exclusfuely © Classes are Used fo encapsul- USCA for dota and I} does not] Ares and tnhevit dara wrich yequive The default access mostAter of a class fs Prtvake by default} liner ts Pure vivtuol Function 2 > & pure virtust Function is q Funuton Nth can be overridden In the devived class bur Cannot be defined. A utyruod Funurton can ioe declared qs Fure by using tne operator =O. 39.[whar are QY tha Operaroys that cannot be Overloadeay] =D Following ave tre Qperarors tnar cannot be overloaded 4. scope” Resorutton ( 2. Member Serettion (.) 3 Member selection tnrougn a polnter to Funutfon (x) WOKOVOYH LOLLLLEDEGEC CELE CC CCS SEE EE y SS voLvvLEULEbCbLEC CeCe eee Sass) yy yb NY % sm 2] *) Dynamic ox Run time Polymorprism ts also Known as method overriding th Lnch call to an Overyidden Faneton ts yesoived during yun tle, not ar tre Complle times Tk means Nauing two of move metnods volrn tr came name, There uot be alway $ only on COPY Construttor that can be either defined by +ne use OY Tht Sycrem « U2. Menod definition ? 3 It moans, we can averyide the method. + lainerher ctabic method can use non «taric member? | Fouse. uu. [Winer are base class, Sub class ANd Super class? 3D Base class 1s te most aeneraiized class,and Mt 1s said jo bea voor classs Sub class 15 Q class that Innevits FrOM ON oY MOTe base ClASS~ Super class Ts tre parene class From vonich anorher class tnnevits: mark CLUNKEDIAL). 1 OVW eLLLLOUUEdC EEE ee eee ee’e’c \ ys [punox V5 Staric and dynamic binding? | > Binding 15 notring bur rrr Assodanion of gq name wlth tre class. © Startle Stadlr QI- IS a binding \n Which name can be Assedartd wlth the clase during compilarion time, and Vr is also canted gs fndi : Dynamic Bin Sings sq cans Yn wNch name can be assodared wim me class during exeuution time, and ?t 1S also called as_jare Binding . Ub. How many Instance | can de created for an abstvatr class? | 4 =o |nstanus voll be cytared Foy an abstvauw Class ur[panien Keyword ¢ “ean be used tor Overloading 2] Vs used fey Overloading. 3 Operaroy Keyword us-[inar Ts. AN default access spedpier ina class definlHon? | > Fruare access spedhler Is used In Q Class deFiniHon. uQ-| inich OOPS Concept is used For yeuse mechanism 2] 2 Innerttany is tne OOPS Conupt that can be used as yeuse maothanism. = fanien OOPS CoNnLePt exposes Only NecesSArY Informatton| 4o calling Funuton ? 2 Data Hiding / Abstracrion LINIKE DIN.)

You might also like