Page No:.45
ta 08.00P (ADVANCED)
allas t sdous inar claxes (subclasses am
wCaing scas (supenclas).
02class_ Animal 16 doiuu a cla
Il code of supnclass.
Aubic.
ctass Dog public Aninat t
IL Code af sabclass 'bost sclna /pnxnt clas.
douuedshild
mclude <ostneGm>
USing namespace std,
suporctuss
cdassAmimal {
public r
-yojd eatOt
Cout<<"I am an animal"<«endl;
C <<"Ican eat <<endlly
/ subclass Animal £
class Dog public
publie?
void disptayf) t
Cout <K V My ame is "<<name<< endl
lint main( {
éneate object of Dog
Dog dog 1,
, \Page No:. 4%
Date :o7Ito 242
7acess inhoted supprcese membons
Output :
dyi.eatl0; I am an-antmal
1 eat
car
My name is Iom
dagadisqiay,
03. is-a ielaimship
g.- Reciangie is a polygan
Onange isa fuit
Dog 1s an Animal
-canbmly accaa am the
ndude <iostneam>
USig namespace std;
TL Supertass
cosc Panent .
Mpnoteded elements.
pnbtected;
shaíng nomc = .
oid
Cout
diglay_namc()
:
< Name <enamc <cnd
E
3
dass
publics
Chi d :pablic Parent t
lattess pnotected membes
vojd initalzenane)
name="Pnognimmiz
di'splay-name;
ta 08.00P (ADVANCED)
allas t sdous inar claxes (subclasses am
wCaing scas (supenclas).
02class_ Animal 16 doiuu a cla
Il code of supnclass.
Aubic.
ctass Dog public Aninat t
IL Code af sabclass 'bost sclna /pnxnt clas.
douuedshild
mclude <ostneGm>
USing namespace std,
suporctuss
cdassAmimal {
public r
-yojd eatOt
Cout<<"I am an animal"<«endl;
C <<"Ican eat <<endlly
/ subclass Animal £
class Dog public
publie?
void disptayf) t
Cout <K V My ame is "<<name<< endl
lint main( {
éneate object of Dog
Dog dog 1,
, \Page No:. 4%
Date :o7Ito 242
7acess inhoted supprcese membons
Output :
dyi.eatl0; I am an-antmal
1 eat
car
My name is Iom
dagadisqiay,
03. is-a ielaimship
g.- Reciangie is a polygan
Onange isa fuit
Dog 1s an Animal
-canbmly accaa am the
ndude <iostneam>
USig namespace std;
TL Supertass
cosc Panent .
Mpnoteded elements.
pnbtected;
shaíng nomc = .
oid
Cout
diglay_namc()
:
< Name <enamc <cnd
E
3
dass
publics
Chi d :pablic Parent t
lattess pnotected membes
vojd initalzenane)
name="Pnognimmiz
di'splay-name;