/PAGE N0.
-A55ignment NO :1 DATE
/ PAGE NO.
DATE :
Q. Lhad ore advontage5 of abjecd Orien te ETher
eG
PrOgromMing over Procedurd1 orien ted +000 Pur Po ge
Pragrdmming 2 OAddi4On
Of
1)Modulority = 00P Promoes m0dulority by
bred king down a pragram int0 Smailer,
mOnogedhle 0bject9. Thig eagier
40 Undekstand, mainiain ¢ deug code Object otien ted =0bject
2) Reusdbilidy = 0bie CS
dif ferent ProJec SgaVin g time t effort Orad.Ghapel)
in deVe loPment.
3) Fn capSlalon = O0P allo dG data ta1tHibueG) ReC+Ong1e CrCle 9uae
bun dled Oradshape ) Dra.sh aPp)
+09ether w1thi
4 Inheritgnce = g a GPecif=c form
Tnheritance end ble funcion Over l0ading
Credted Lof Poly m0nphiSm ohere mul HiPe methocd
exigting ClagGe9, in heriting ther'r haye the gcme nme
behovio urs. dif ferent Parameters. In
KeaVO Ctt C, f dnc 0verio aoing
uged 10 achieVe Poly morPhigm
Poly mor Phigm 2. Ho) doe9 at COmpile time provid in g
t0 funcn overloa cing 2. me tho c lth nam
It
ability then dif ferent
One forrm the Pragraming
Credte funciOn
9ame
diff. Clkgument. which
per form diffren +19.
/PAGE NO.
PAGE NO.
DATE :
DATE
Q31a)haJ CLa999t0deni ouPut
morR
like ndme YOI nUmbei
memer functlong
InOlude Norne= Prtik
ROno= 2
thege Mark 30
#incly de <iog treo m>
uging ngmePace
Co. 4state differenceg between
9+udenJ encaPGu dtLOn..
PubliC: AbSrOCAOn
Gtring ng me )EncaPsulgtlo n GolveG
in t Yoll-n0 the Prob tem in the Po blem n
inJ mork design 1evel. mPlementa +LO n level.
VÚid 2)4ou con ahsttac2) 90u con
Ab9tIact cia95 encalgu LatLOn uging
Cout N me : e no me <<endJ Access Modifle rs.
11
MarK = 30dter 3)ner layoUUGed
in 1ermS of design. +erm 0f
im Plemen ta ion.
main () 4) HideG mPlementaion)Hdeg the dodt,
Gtuden4
S1.name pratik Pati " j 1 Gecur e theCode
Q5Jhot
down their GniiCan ce,
/PAGE NO.
PAGE NO.
DATE :
DATE :
here three
AcceSSGPecifierg Ore Public Private employ ee
Jdta hidin
be chieved UGing theGe DuOVOJe:
hdve public,
Privd+e GPeciier.
) public i a boye fUnc
Puhlic VOriohleg be Privdte.
everyonp. It C¡n
member fUnCtlOn G AfthelagG 3) Pro tectedi
Pro+eci ed memberg ofthe Cre
accesg ble by They Cre
RamP1e acceG9ible thdt
CtagG. 0ther thon porent ¢ chilc caGs
Pubue: they dre /n acce G9h1e.
ellxeiass exam Peiue
In ab 0ve Pxd mpie ObC ¢ dic p)unt
igPublC.ot
2) Priva te i
Privg +e Qbove
uging the me mber fUncto ng Pro tected
MembPrs re
privaJe It meang C lcelCHOr" wlth methodG
Specify ing the atae Gg gpeciAier then
mem bers func Credte a abeet Perfor m
Private.
Orith metlc. oPerdto n.
/PAGE NO.
/PAGE NO.
DATE
DATE
# incluode <ioStreo m
uGing nom eGpaceStd
Cd1CULa t0r Cout <<K"En ter V läe af
int Cout <"En ter
VO td addU
CI.@dd
C. guhj
Cout<Additlo n 5 << C<« PndJ; Ci. muJO;
Ener
En ter
Vord Additlon 91G
MUltDliCOion
0iyiGo n
Voic dty c) the clifrerent t0 define
membe r Give
OF each.
G"<<C <<endJj
/PAGE NO. PAGE NO.
DATE : DATE :
>There 40de fine 2 ousS1de defn:
fUncn #inciude <io9tredm
ugin ndmes Pace
Ingide Clas dep
Ex#include <i05tYe dm
U5ing nom eGPace
publio!
Void ado
CoUt <<"Additio n <<C<<Pn dJ;
CoUt<e"A ddiOn ="<<C «en dJ
3
main
O/p
Additian = 2.5.
AdditOn 25 CQ.80efine inline functOn. orite C Ctt
Progrom for finding 1he drec
triangLe uging in Line fun ctlns.
An inline funch th at
expgndedin. line. lhen
/PAGE NO. / PAGE NO.
DATE
DATE :
Inlin p (0 COmlere orien ted progrdmm1ng
Oriented Prog ramming
fUncn the CO-mler
Pro cedurcl 0YieOed 0hject 0riented
Progrdmming Program m
ing
Inine funcn dre div ided 1) Prog ram I9 diyided
the funcn defn dre into fun ciOn s.
fUncn
Procrgm 2) De fernd5uon 2) 0epends upon
func(Ong objectS
"Progra m =
# incudp <io.9 tteami 3)MOre focu On fnc3) MOre focus 0n ddtQ
using ndmeGPace Gtd
41esGGeCUre,reuGa 4) MÙre 5ecure, reugah
Inline floc+ drea (fi0as a,fload ) bility, mentain ahility -lity men tdin do ity
retUrn ((o.G)ab) &0tt0m-up
3)It
PproCh approch.
in main
Provide aresS
Provtde accesS SPecifLer Guch as
trianqe = " area ( 10,2) SPectfler Privclte Public Protected.
$aclasS0hjeCt,nherita 0bject, nherltance,a
Area 0f ncePoy morphism. PolmorPhiGm
thgngie = 10
hid ing 5
g) E - Ctt,ythonJava.
PAGE NO.
DATE
diereren ce betn Poin er ¢
referPnce 9.
Poiniey Reference.
DPaint eI hatods the
another
3There be 3) There
pain erg
Operdtor gre
4) Reduresderefeen ce ) 0eeferen ce not
the
Has tg.0wni01age, 5) NO GtOIa ge required
0
6) e
CYrd y
41 p0in ter can he injt )Rereren ces mu gt be
-alized at any me ndHtaized when
Cea4ed
8Nu vdiue can c95i9n 8) NOI VÚ Iue cont be
10 Point er varit. directIY Q55l gre dd directy.