SUBJECT
NAME: PAGE NO.
ROLL NO.
TOPIC: DATE: STD: DIV
TERM: ASSIGNMENT NO:
Oor Crractico uestions)
List cltferent ccess SPecihers used in he
and Describe u3e of inherito0ce
the class. privactc access SPecfier
used in
Public
Prixate
Proteched
ivabe Qccess sPecitie is
use to decare a class
that accessible by the menbey
is
member
class and itis functians within itrs
0ot accessible for
dexiyed pm it any class innedjabely
LiSt diterent access specifiers used in Loheri
and Descmbe use of tance
Protecbeo access sfechers USec
in the class
Pucblic
Privacte
Protected
Prote.cted occess SPeatfier is use to cleclore a
member that is QCcessble by the member tuncions
class
within
its class ond ony class imnedia+ely
clerivecd rom it.
32 LiSt diPlerent aCcess SRectiers Ased in Toheritance and
Describe use of public access sfeaficrs used in the clasS
ublic
Privat
-Probecttd
Public occessspecither is use to declaure o class
mem ber that is. accessible by the
membe functions withic
its cags and olso ciccesSible for derived lass too
3 ut oukkerand aCcespeuhieLs ULARd
n inhesrtana and
Descube se Public acces4specahier
uLd in ddo-y
A ccess Speciiene
Privot
Protecteol.
Public
AL epublic occeA spee kie
base dlaa u_puhlicy ánhuited by a desived
clas then piotected nmeubeu ok base dass lotcoMes
DLotected mamaus and pubie membuu o baje clas can
ae acceyec by buth tue member uwnchon odLeu ved clay
9 Ael 0s otojec ok dleiued elau
Deku wlt leuel ánhuuance. Diao the olagtam T shro
nmambeu
ultilevel nheutana w u g claku boitth dada
ano anbas kuntio
oleriutd cdass Ls
A peuung a new dlass o m alieady
tante
cauedCs nuuli leuel dnhOu
Class College
Dataonmbeu : eollege.Code
Membehunhon getcolege )
ClasA studeut
DotanombeAs roll-no,Qame
membei unchn9 qetstudent Q
Class Result
DataObel Aade
ombouhunchion qehesultC)|
Page No.
Date
5 Dekine mulkipte unhutan ce DAaU thu dLiagkam to shoo nullip
Anheutonce ung dlajses oith
dlata mambos anD onmbu uncun
mo taun one base dau i
A A cAas6 can aso o dLWeo Ao
call eol wwiplo nheNtance.
Clas studentE
Cass TeacheR
datarmembe nam,rolbo
datanmem bers Name Stabh id
mermbe tunthen: acceptsC)
memb Functiorn aCceptC
CIass iofo
Coinmpule ime poly mo phum and un tu
6
eenta betuo e e n
DuKt
polumoAprum
Run hme
Compile tinne
s l ecttene
an object l n tuu polymoapnu m
u poymosphum
done a t
ubound s unchon all at Cppaopaau functon
COmpule tume
Funchon to oe caled xe unctou to be called u uweuoo
nouon weul thDie until op pAopsla elehem u ma0
Thu does not augjuiue uat ek TM Requues u s k potew
pouwt aojec bbiect
enecuukon a e PuchoniCalls eneCtuon aLe
FLnctOn Cal
ostt sloLon
JmpleMeuted orth opeali u ámplumenkeo ioi t h
oerloadung os kunehow V.tal funckhen
owmoeOug
Page No.
Date
Dgu polymaiphism e Aut Js bypes wi th eranmple
A Poy moap hu m s dletind 0s @buluy do take many oams
e l o u b an ablty crscr
incaus oClases Cund ebiect Poly mopbum
due To aouch bhjeau
t u oleject to -tcuee many kox
s pond the nt L
oelongung cukk aneut Clases e ablu to
ciuset oams
loat
Sume meucLq n a aHeo
Tuoo tyPe
Compule time
Run tbnme
Runtime
unhen a to functum
Compil t u e The tineng o clebinu
tuen
Compils tume Cempio ume
olinutou Colu ch_ocCL O4 tamP L
pouorphum
exampu 1)uunetuen ovealoadung 2cperator oualocudt 8 Wute u
incude iosream h A wuy e
nclude Ccono-h Lwe cQnu
Clos cLeo The
Tho oe
olehed
public nau
void cu ea (kloot r)
Binau
wuu
hloout a QUnd
a 3-)4 * Opeatoa
void aAoalintiintb)
inta
a:L b
"le
Cout aLo eAectangle
Page No.
Date
Voudl wain)
crscr)
nt Le b=2
oat r= 2
aaHea
getch (
RLunhime jpoymorphum Te neung untuon all t Prunho
cleinu tuen oluch ocus ad auun hms
Funhm polyhmerphum
enampu Vuutuua unution
9 Wute uules o opei atna
Oueloactung
A Ovu eutna oPaatoa Can be owu lo
ad ed
we cannot clounge tu
aasic @anuna Op.eOt D
Th OLeload ec op.eatDa ust
ha ue atleost vue op.eianch ot
oleyuned type
Uuna puato n a n euerloaded
ombe funche teke
a e u m o t auo cLot t u n a y value
Moma
untom toule eA Cgunan
Qndl wust utun value
ObeAatoxs caruot be eload od Juch as C,C.*) , (sizeof)
2), )
Page No.
Date
Giue syntan to dehioe op.eratoxunchbn
A
rehurntype ope rator qp (aug iat
/Op.ekaog untuon evetendire dahini tuon
Outsi'de clo
YeurntyPe Class KWame op-exoto s Op Cag ut
op.exctox uncten dointien
EupLai poiut e cuuithetic orth emcunnpl
A
tOut tue uas ok ollouaiug 0 t le
A oS trunc. Dleke the contents o the fl dt eust
j0S apPp: Append to end o Fue
105in: Open ilc or rtad ony
10SGut Open le kor tortte only
Open C):
elose C)
Seekg)
Giweantaa t dehune dleiwed clas Coutuctor Grd deAbe
tine osdn o ene cubuo o oat uu co oAollowuq_slaue
CLoss Pubic A
CLass A puhuc B, Puhluc C
Page No
Date
A derinedl derie
dasp
Suntaz to
Clas
LOLsCLuuned cloLLd: iusi kility Labe Bae
D eiued clos body
3 Des Cuble the wse o wtuoal hundton
A ln noteboo b
Desube tu use o_pu eutua uncruoo
SDesCuhe he see o abstract baue clas
I Ge mearuna
int aLs- (123,4, S);
int ptr
ptr= & a
cout *ptr n
Cout ptrt+;
Cout ZL p t r u\n v
G1Ue meain
int ptr , aS peclaxe poule Vaaiablu ptr and vauable a oit
u t a l value $S
tr- Xa
CDut 2 ptr Inuialize pouulir vauablu Lorth oddur o vaiablo a
sove auddues ot vCLaLlL a n
out Le ptr) tl pb-)
Duplays the va 1e value at
PAsptag value b odd -us s tore
addingI to th valLuevsAdle ptr-It olutays vale SS
at odduM 8toaod