0% found this document useful (0 votes)
15 views12 pages

DocScanner 30 Sept 2024 2 33 PM

oops assignment
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)
15 views12 pages

DocScanner 30 Sept 2024 2 33 PM

oops assignment
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/ 12
oo Assigament ole - - Dork | No: + Qyz. | Shaka Give example - guru — => Fer data hiding and -encapsulaton parpase } access SpeciMer 2 member class. can be ‘define coith differen! level’ of aocess fe. diPReregt wishiliky modes - private — Keyword private public, and protected Gre _Ussd to _Spe cify access centro} . — Example. member O class de’ine as are accessible jan the class only =follew'ng table Shoas ho@ the member access JS Contooijed by A S modFrer. Access Withia outside of Dermived Mode class cJass class private. Accessible | Nok Accessible] Not iy ‘ df Frecessi ble Protected Acce Soble | Not Accessible! Accessj ble pu bhic A.ccess/ble. Beccessy ble Access ble cit cl = By default. ue OF. Class are palvars ass accegs Specifier. Dot mentioned) at | ep = Tes Common Pfactice bo declared Data members private And most of the Member FuncHan care declared as public. ar Pro kected . v oo r PAGE No, 1s } = Access modifier “|S meHoned c_ ber : member _deAinih'oo , Using Satan Access ModiGer! ole One parkcular access: 'Spedbiep io~ Menhaqed.\ Qi! the? member gf rn = sjet_Same access made, Hil Nec Bicces™ IWinde fs Gpeelfied ie ClASS Demo taka : public Noid FC). a U Some coda. —Inr the above example. sFanchieg Fe) je deAne Oss pub public: Rochon. | = Since before declaration af Varjable OFA Ca) o there Is no Access modifier tes by dePauit privabe | =These |ceyunard are a|So Used to mention: type af tober kane oe derived “Chas. Date eeaae a ) chen and classes are S990 —OSSSS1 Ol bape OF oprivele mele a pa © —&-2. | Com prodedare d Orienked 4 prcyram ming and objec oriented Protea ron sp —_ rocedured opiented | object orlent< 4 ___ Pregram miag Prosfarernin gy | program fs made | preyram fs _made_up up of procedure . of cjasses - Tt Uses Tee Down at Uses Bottom 4p approach approach. fr pregram | desi Ks) Sih Tasept 3) Doeckt pProuide: Feafure pegran desidn. prude Feature like like poly morphism polymo rphy's faa) inher ay ce, he. ‘aBheri bance ete uj) [ae ic Less Secure. tt js heighly Secured El ste dea)! s lth algoaithm| Ce deals calty data. é| lat take Nery less memory | Ft take more memory than Pop - H Bl here Is Ae any “There [gs have accesc access Specifier. Specifier lex _pudlic priva be protected,efe. AltA pop, we can't | Tm Oop, dver}eading a Po} 7 = zat pee forry overloading WS pesible. datupe of (7? {Sicapacianar | Lets defined as. the lof dite £ faq je {=the Mechanlen +he sbiad [Pace no: & ; l UOnit — Ie Defined Base class and 2xQm{ol< - class pith desived in : a base class {s a cla language Fram Object Base Ss orfeo bed progtarmming derived + The clase has cil) which other classes ait which tnherits the base member of «~ base cla can also have Some a The base class member are_{aheritunce fo class. A base clase |'s Superclass aip_umember apd: prem base class object of | the Derived class: A class that is class create exjhing class. The derived class Inhert OR ce « The derived [th respect te “the cla sis: qSvemel) as ddyHonal properbss and [member Fuschon derived called parent class 3% Inherit ber Funchin class: cag have acese fhe more Funchonally Base class addi can S class +9 Derived ecily ass Is ubclass. Lalso calied Bas @ child dace ar Example, +H Include <— 1oStream> Using Namespace Std ; — t + __ |) Base class class PAqg Pe 5 tment public: P Mold set Width Cink 4 fpbws) bs : w@idth =A} coset | sein ——} —vsid sehielghkC iat by peb) tia Xe Relght =h: 1 : h — pProkechecked sy ' a Nt width 2 , tet bia int height 3 nt f a S —— I] Derived class class Recergte: Public Shape. < j pabilec t Ink qe trea Q = { Kit eos cid [ote Gaia: 2 : a, eee ——_} Se+. Sep agh : i —j Eee |__I priot phe “area OP fhe objech. i << Rect .ger ee he Coup ac the lola) clea reac) 26 end); ; are as: veluro 0, eee put pup Seis anys fits total area - 38. 7 What dre the type of toher! tance —>TThere are various Explajo jo deta) s- models of tnhesitunce In c++ programmiog as Follocd: i stagle jnheritance. 2 Pyuipple joherjtance. 3] utttleve| joher/ bance. 4] hy brid Tohber/tance. Dhertance. S\_trerar chrra] ‘ Single _inhen' bance class Inheri ta 0 EN single Inheritance ane Let say a one class exacHy + for exam ple 8 we have class A apd B apd clase ic derived from clase fA- clase A C Base) [class 8B Coen'v using Name cpace Std} 1% Loca) ivariqble ig Stme i as ct memoer name */ clase Test polvdbe L yor x4 public | Word Set C'ntx) 1 I] the ‘this? pointer Js Used to Helnivs the “object ot IE hidden by the lo ca} Variable Ger, Lhitg Se =f 1 Vord prin-LO Vcoube cg "a" SaA eeend [ioe -marin fast ok tot_x = 20 a : Obje. fetX Ce) ps Obj ptink Oy : z redelrO.g! 3 ye) a1 eds Date —> , i : RO 20 = | I Here name of Jecal Vatisble nan: Pe 2. Jp Same member Votiable. Ng, in Such Shughse wha can US e Weinier access Member Noriuble,

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy