OOP Assignment
OOP Assignment
Date..
im agt i O
xetumi
Nold main )
getch )s
Output 1lo
hat is poitey in OOP ?
this pointe aite_a osan
Ans Yeobiec In Ct} hos access to ris own
oclene ss dmough an inpratapt Doiter Calledthis
poioteythe his poite ts an implicit implieit
POometer to all membegAneions
iaiend funcions olo nal haxe a'this
PoiDte Decause ulends Coemot members
ot aCloss Only member funehions hove
a this poime ,8
Pxoananm for this poinhey'
E nchide iosheam.h>
USina namespace d
lass BA
public
(onsuctar clelioion
Pope lduuble 1E2.0, doube b 20. doube
Ouc"(onstucor Called"c end
engthe1
boeath b
Page No._4
Date.
heiqht=h_
dauble Volume()
getumn lenath breathd heia
h t t h e opeaatoas Can
chamged the
O ft h e
y_of
Cquments
erY exept the function a d
ume
only
Ou CaYm have wo tun1ons
Dint Qacintx,cha
1)intatitx, indy){S
At kast one of he qumens must
dtfex in he data ype 0 the aaclea In
wnich the paxarneicas Co passed should
not be ot Same Clarte p e
Cpescho cNeylandinq
NOu Cam aedeine cY OVerloa.d mos
of
Hhe bulB operatoys chyailable Ih cttthus
a pabpaome Co CpexatoSuth.
USe
tusedefined lni.
pes Cs uel theae you
CaD use Opexcrtox 0s a tunchon do l o
tusk other than
What r geally dees
Stax
'et-Ape clSS-nameOpecthoy }(Oroclid
operOAons
d a d p e is the 3tum tPe
Page N o . 7
Date.
th=
whch
cass name is the name of class io
the
Opex0Bo) 15 lotcked oith
s the plotenolede i.e eplato #
Opexto Jo be Oveloqdecd- o p e r a h o y ¥ t t
Ce opeyaHoy topeorcr do be passa
g-liis the lh of gumes
SapmBax
vitual <undpe itun -Damez(
lkode
DefindHon S qven 1S base class.Base cless
haNihna unction Can be instamHiated e ts
objeelcan be n
made. If cariced class do
edhine Ntual funcdion af base clasShen
E doesn E ki CompiladaonAl olevedl Clas
Oma no+edetine Mtual functfon of
base tlass
Pae Nuuaunction
A punt Nmulfuncaon is a membe tundiea
ok base_cass hose Cnly delagzc iom S rovded y
base tlass hen mo cpapticedtipn Should be
defined io derived class othemwse clexned class
aso beComes gbstyacBase Class Couinin.g
lpune Ntua funchionbecomes absrad
SuntaX
NitualZunApez<tun-nCYme > C)
20
No definhon is given in base class. Base
dass hove puae ntual üntion becomes abst
ga ie Cannot he msBantidBesF oherived
Chess do o t oedtine ovhtua functlon at base
assnen mo (omplicatiomAm0buf ceaiyed
class also be(omes ashraet ust like base cla ss
fill derned lass ymus zede puae lIhua
anchion o base Class (ATCOF
PageN
Date.
Oveloachinnq
pacgaanm tor tuncion
and apeacttozaNeDlogclin
HngouncHon Nenlo.adlinq
include ioshsamh
Usinq mcmespace Std
Noid i t inti)
tout ci Hexe is int<1(£end1
Nolc pi (double)
int main ()
p i t l1o)
point (lo-1o)
i"Hen"
Ohprt Hene is id b.
Heeis fload lo.lo
Heae is they deD
sOperodo Uyex bodinq
Eindlude Linshream.h>
USing Damespace kld
chss Complex
poiNahe
iD TealL mmge ATCOR
Page No..
Date
public
Complex Cint 20it jco) seal D
imaqi :Y
This is auBomaticallk calec ohen4 is used wlth
behueen 2 omplex objechs, (omples OpesctoxT
CComples onstob 1
Complex yes
fes.ec oeqt obi rERal
ES imag maaob mags
Tetuon s
01d paint ) {outccrealH'Aimaq arend 1
Output 12 tig
(aTeos