Relationship - inheritance....
Relationship - inheritance....
Thheilance.
Snkeritan is a rature ot o0r.
’A coss Can isheik daty embens aud Membey
unchig ot anolher chs.
a dess o deie, mpentes
and chavattev'shic from anothey cas is (alkd
inhenitanc.
one f the ast iprfant tatune
>Sohesitase is of
ot cbiect Oniented Pnyomping.
>Snheitane apreses Ae
clas Sit, he base chs which exhibits he feotane 4
lbody of Sobcles
clas- A)
# in Cede<iosthron>
Usihg nanespare Std;
class studeyt E
Pub lic:
Woid Study (05
Cout e"Stadent is studying "kendls
Tony ti
t. stolyU;
MaHjevel Tnkeitonce
Tn this type of Ihei tance qa desived
class is Cheated thory qysthey cleived elas.
(Base class )
class 9A (bast las)
class c
class A: Pobic &
3;
E. #jn clade <iostheGM!>
Using Danns pate shdj
closs Vehicle £
Pudlic:
Vehic le ) £
(out k This is a Vehicle \n';
3
class toutg Dhee len : fablke Vehick §
Pablic:
Hetunn 0;
2-Malliple Iahenitanp
Maliple Tnhesituce is q feotate of Ctt wkere
Class Can Taheileuta Tnheoit fheM Hothe than
One classes
oue Sub clas inhenit ote theu One bose
class
BaSe clqss
Base Cl4ss- 2
cluss
(0cied cs)
cless 8
c lass C
he ton o3
cless
cless £)
clas derivdclasl: aces s_spedfiey bas cass
closs A
3
Class B: lublic A
lbody closs &.
class c: fulic A
body tess C.
class 0: Public A
3
# inlude iost heo)
Usng namespare std;
boç.class
class Vehice S
Public:
Vekicde ) 8
(oute hi Vehitle is
|| Main luntion
by tonbining
(orbining Arerakital inhenitaue ond
doh Exapk:
il) Chrakd hybid tin koni lawe in
Tlolfjple nhevitance
farttalay Synlu
and tulHiple jnhen fautts
lhhevitne
Aybid hhonibae in e
c lass f
class G
class B: Public
Public F; Pyblie G,
class E:
Class A: Pablic 6S
Pablic :
fone )
(out eu fene ot Vehic le lu'
3;
Enst sub class
clas lan: lublie Ve hicle S
leblle
Car C)
fynt tin
Bus obi 2;