Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
Write a C++ program using concept of multi-level inheritance.
SUBMITTED BY:
Nrupeshsinh
DATE:
June 26, 2016, 4:15 a.m.
FORMAT:
C++
SIZE:
752 Bytes
Raw
Download
Tweet
HITS:
444
Go to comments
Report
#
include
<iostream.h>
#
include
<conio.h>
class
A
{
public
:
int
a
;
void
show
()
{
a
=
10
;
}
};
class
B
:
public
A
{
public
:
int
b
;
void
show1
()
{
b
=
20
;
}
};
class
C
:
public
B
{
public
:
void
show2
()
{
cout
<<
"Sum="
<<
a
+
b
;
}
};
void
main
()
{
clrscr
();
C
obj
;
obj
.
show
();
obj
.
show1
();
obj
.
show2
();
getch
();
}
#
include
<
iostream
.
h
>
#
include
<conio.h>
class
A
{
public
:
int
a
;
void
show
()
{
a
=
10
;
}
};
class
B
:
public
A
{
public
:
int
b
;
void
show1
()
{
b
=
20
;
}
};
class
C
:
public
B
{
public
:
void
show2
()
{
cout
<<
"Sum="
<<
a
+
b
;
}
};
void
main
()
{
clrscr
();
C
obj
;
obj
.
show
();
obj
.
show1
();
obj
.
show2
();
getch
();
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus