C++ - OOPS Part-1
C++ - OOPS Part-1
gohex)
toyethex packed vahíaber methede,
all have towise Mellad-
9t Login (O
nmahalks data, hulated pack cading
to infdea gaod 29i
for ems oths esentials kothaStaitonay
m clothei, lke togete
Schol
Conmbiaing eatit logi aaingl teaethox
l Encapsulatioy dat
heast Tae
tane Iahesi (O,
oaituted ohject kack buldig The
.C40bjet
Oietd
NGO. PAGE
GOLD
Data
Abst radin / Pete titig9 ne kicing inpem catati onal
to use.
dotils and
Ex ) Jonplementation dtails can enguey Coelig Breaking
lidlen eem the uer
itelace to iat esact with ham,
engáe, cte
qeanbx ayten,
chemial heacio in aú condi t oning
Possod5)
as
234CE.
Seatag ap
Child caLser
Bite Car Tauck
4)
’Bkoas
ntanpulatim AaphlEa
lent a ch Whie ta
chd The
2 Vasiaee Ahat
det obiet ike
yen can
with are cas. cdass lite-ne be
Tzuck
- haeCan
mane, inwil Callacti inhetited
thL the may
centa Tyscetapspeed
No, same al
clae oihex haue
be o
Ags Aame boatSpace hom them
paht t Vantabledncitn
wntheiqun
Dhject a
ge utn bust
s et Veics oill
but DATE PAGE NO
code data Ositated t have
bike
yeoll
behave mean cass
andcoele
fdata, Comaen 20
bekane ont
abyeta Dilenant pupeiti
o
do
Exanplei- Once " . "
ain({int studeat
clas object class a class clases sreetc. "
t 20;namecha
each
On obje Mose
holNojinlt
getDotaik
()}void dt
detlh
Adent
shudent, a0se can rogram othey
; ke Ctf n Can ataeopeotitsiouun ae
deihed
cas i be rn
|| nell variables Run neal
S1 Considsed data
ereution piterat abot
, and
Nosheded2, class
that to tme
a woald
aa gethey 0r time
lete. o objets
9 as witot
codo. etities
ot
wil
shudent tye objeia ep
can we a Compl hresentatiom
ave class.
Becondod 3 bupit talke having
their ase Caeate
-the to in
eron
memeo a
functitnat anstherby wil code
Pepentiu o and
clcosass contain
supaas
popeta ohet Moreeche
exist
The Las be looks
pastitien) codeThe clNameass
Cause e
Code is Were
paateiedi publifeactios
o
hitance in i
declatation
Salable possible
0rganised
mone
prtdatoedtea
hedundant du
faen
to data
ixtehet
Subclasses.
ertended
small to obje DATE:
PAGENO,
code
ca/elauea.
20J
toseqmandalinLodiCodo'
lasge is
elininted, Can Co
Data Encapsulaton i- Encap Sulation Can be wsed to hida
data membehs ad wombes focdion. that tho iatemal
’Under Hhá dafinition , en capsulation Mkars
supresenation an
fom vieus
kidden
outide oy heobjct
. Data b hidden
dafiiion.
it
olon't o JO20
oidth wones (ind
denot
is A)
public in
acesi
the ble.
1.
EXampl2 Dutputi Thaidth
Cout " sdhaigkt(5);
Uust
das shepe. shepej
Shape
we
'Vsen
Cot Hincbdee
VserID;int
LAerID id Shows The
Ws
a he
i6stream width
Helght
how causeeo
be is
o2. i5.
absba Cant be /ttsvasiabe
names
eti idt
on oont
bt
acccssed
tount ac wook
data
ted" them because
manb
ers hy
ce
dl; ay
priuak. poñvate
tonret data
Patood
Lsexl.authenticate
Dooo);
("pass autketiak(Stisgveistad)
ele pasioond menbe sin
cosieot hd
Paswsallount
acated
soa:
fat
Cot e ,
paswose"lpgv! wethe
fet
InmetLassd
Sucesah"
Lagin lot
the
wll
knooutenteredwey
not
DATE
oak
be
passLoond
he
Acces Modrfess /Aces Spuafos.
c44 ackieed toith the els o Acces Modtkes
fe
are kaon as Aess speciiens, Clas mtnbers ( both daa mebes
md member unctiy can have vaying acceyi bil ty
alcels
(2)Psivate
() lrotted enbss will take privote behavio
Gi)
Same caly
Bpe
No No cid deivçd -dsub
Yes
boeted Yes Yes Can, be accegzed in he
Jas, inhetcd in a chd elats
bd cad be acceMed outide .
Yes Yes >(ite Can onl be acesed inwide th
Cae, it can not be nheited oY
accewed htsides
Accem specker inhei Acd cutiyah
’ any class menbers (date munbosenbtr tuntio) is
udes
() Ase acLesibls to evnone
(2) Can be accessed.
exs tindudo <iosthcan Bot mainl )
wing names pole atd; Ractagle ne di;
publie:
fnt anea)
braadth; hetun 0;
al()
O (z)
aating Dteuti tbheadthhuct20
e alaed to
Dal, class
can Redaagle
hedl, Rectangle
privatei clae
sele publiei the speifir
Acasa ath
eesviagottr setusn L
aneabacadth;
nt0Lungtisht,
meab ass
clbe
/sett the
length accesLed
es aboe Membes
ambeh.
seti' boead Ae
unotin
(2) pauate hy i
th
settiny o1 decdared
funct
e"Asea
Cout
publics Redanglclasse usiny data he
Vales 'nt pzivake ntes
asnd DATE PAGENO,
lughe;aea(int int names nembe daclased
via length, JD20
poce fantion ttaeni GOLD
fhunctpublo breadth std;
int , bside
a
Ci20)e,; b) ; clan. 'the 13)
inclde
iotream 6 (3)
hetm; 3 publi aCceibleThese 94
henited
psotected : Bat,
he'in lchild / s
note
danied Membx
the das aestd
blae paoected
fn ame A
the (s Acress
s
able den ubcasses as
photetad
wed
membeu accessibily
psiate
to
access casr ara chi) clareddo
/Can data (paut/supn)
/Bau
lprot clas.
nenbe inaccessible.
as ases
manbeis atol ndes
cceu a po
data teted can -
the cton proe
poteted
manbers
data
(huigli) memb outidoBut alo cted
data access
donsed
cas or. then
claebae membes, -
ae the
GOLD
PAGE NO
DATE : J20
DataAbstoa cton
inpleaeatatis ataih ox a pnceduse and just
This done.
bhw Posta Absthaco Data En capultion16
’ Data Encapsulati on isths pocess iing the data L
(oghams from he ousde w0ild and euudiay
etiy
Dato abstoact'on is the prvess ol ding he inplemtation
'fside a'
the outide
data abstaoion i achiered with the hely o
data enlapsulation we Can S absta ction is he
ncapculation.
JO20
maiO4.find Exole
A class cas cas <iostneam
aj inheited class+inclade
{A >
lçnot ly (otected:
ade: publicnamespacestd;iny
laa 8: pzivinty; int x
x0 xà ci
phivate inhesifedis
prelect å pubke
ot nhes
in inherited iakeited
inherted
heoited A
ited ed
nhost A inhenited At
{
fed bt but k
polected.
stasondadbut stay stay
& be be
comes
comes be
not pote puie
comas acceuible.not
aCcessible.Palvatepzivae ded
paole in in las
child.
cted chi.
4
Iahoitanle b2-1 bx1; Qe2 1
EasierLues doz1 dex1
totime
maintain kalows in
JnheitnceCttin
to Ctt |Ldoeay't
cade daean'wookt a ldoesn't
appicaia i
wok
wok
and au
asypuli
edit accessiblerot DATE20 PAGE NO
i
not
codes peedad
GoLD
uhuhited.
D.
(19
Modei
lsivate(3 (2) fbieMo(0
da
’hoteed
members
nembe livae
membe ’ ’ ’
ede)Th Paivate luble site Photeded
membelPublic
e Ex Saves
De
heases c
ac ded
cess class t
ble
membess Modai.
Membeu members me
3. A n
4
o! esibleacc-in el
base |Pivade
base in base
-accessible
clais cass
as fered
becone be aote das.
desied
Subclas1/cla)
Ci:ld Sucas.poy clas/base
Cone be |Pcted. class/
in Come
dohived
vate
Poiphivale (protected
peected
publie
clal.
fn in
deaived in
deoired cleired
clas. class
clas.
PAGE NO
DATE: 20
Inhois
OSingle
4) Hienaschical In henitan ce
Mulhipath Iaheidance.
clas
mithods
Vatiables ;
cosAt4E
( cloasossmB; MB eam
om pasenta b inhei caataom
A1 AtB.
(2S
A