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/ 6
blhat 7s a in C+4+9
feast .
Polymorphism in_ simple Meant houing many forms.
Lts behaviour Ts different in diffeuent sTivotion.
Bnd inis ocwrs when we have mu Hiple classed
that aque belated +o each sthen by Inheuttance.
Two typeof Polymorphism fn c++ ue :-
* Compile time “Polymorphism
#_ “Rontime Polymorphism, @codeus_ notes
Po lymor phism 7
-—
J .
[Compt Trae | [ Rontine |
Ly [reed ores | FL vreaF
LL, [Oper oveteatiogy Lythe essenttol
etaSis which we don't Wont +p Show the usell
or Aiding the detafis which que irelevont to o
PoutToulan vs en. ;
| xJhat do You mean
Siefeuence
by call by valve anol call by |
| Sn call by value method, we pass a copy & the
Pouiometeu iS passed ® the fonckont. For thee
Copied Value a Tew Tmemory TS assigned and
changes Made Tb thele voluad do net wef leat
sme Voutioble Th the main fon Hon.
In cowl by sefeneme method , we pass he add Hess of
+ne vosiable and adduess Ts Used to access
the acteal argument used Tn forcen coll. So
changes Made Ta the Ppaxamebey oben He passing
asigoment. a
krfghna Agrawal (Ltn ked In)
hat 18 an abstract class and when do you
use i+? @ codens_motes
=] A class Ps called an abstrad class whose object
can never be cueored. Such a clacs exists a pou
en for the deuived classe, ble can Make ae
Class abstrad by placing a pure Virtual fonuio in lass,bate
a
S-] blhot que deswctors in CH+Q
3] consto ctor 7s autoretically colled when an
object fs first seated. Simflauly when an
Obsect is cdatyed a foncien called datueter
automat c oly gets called. A descr hat the
Same Nome Gu +he congtwetor (which Is the some
Oa the class mame) buf is preceded by a Hide.
Bx ample :-
class A ;
private :
Tht val;
Public:
A Cint x) &
val = x;
ag
$
-AUS II datuder
t
5
int main f
Aala)-
Hetum 0:
5Explain PRheul tance.
Inhettance fs the peeene of Cueating New
classea, Caled cleuived classes, from existing
classee aue Called bose class. the deuived
Clacser Tnhewit att the capabilities of the bate
class bef con adld new featre and wep ine met
of their own.
Bxomple :-
class Vehicle
eee tl
joel AmounFO le
Capacity)
apply Brokal)
I 4 SS
Class Bus | Class Cou | Class Teck
Class Bus, class Cau, and Class Trvck Snheu?
ste prpedie OF closs VehPcle,
Fhe most Important thing about ihheuttance
?s thor PF peumits G@ode Lent abi itty.
ferishna Agrawal ¢LInked In)
What aue Static membeMs and
ilhen a vesiable In aclass 16 declawed Stove,
space for Tt 6 oMocated jor the Lifetime > the
rom. No raatred how many obfects o thot classDate \
Page
So, Same static membey con be accessed by all
the objects of that class.
Static Membey fundien can be Colleol even if mo
Object Of the class exlst and Static function aue
Accessed Using only the class mame and Scope
Hesolutien Operator,
@ cod eus notes
8-] hot TS “the clip festence between virtual foncHonu
and pore virtvol foncttens?
+1 Virtvol function Ts Q membeu fonctian in the
boSe chss that yoo Hedepine in’ a denivee olass,
I+ fs declaved using virtal Keyword
Bx fe
Class base £
fublic:
virtual void fon OF
i
i
F Pore virtual function ?s a function that har mp
Tmplementarten and. is dechiied by assigning 0.
3+ hot no bedy-
Ox:- [class based
Public :
virtual votd fon) = 0;
5;OW =~ @toders_notes-
For more Suck note & content —
| Join Daa
a CX
Channel Lk: @