Single Inheritance

Output:

 

output of the program:
a= 5

a= 5

b=10

c=50

 

a=5

b=20

c=100

 

The class D is the public derivation of base class D.Therfore D inherits all the public members of B and retain their visiblity.Thus the public member of the class B is also the public member of derived class D.

 

 

Inheritance types by s.kamatchi priyanka