Hierarchical inheritance

Hiearchical inheritance is an inheritance where there is a single base class and multiple derived class.

 

Output-:

Manager

 

enter the name of employee  messi

enter the salary of an employee 100

enter the title of manager manager

 

teacher

 

enter the name of employee ronaldinho

enter the salary of an employee 50

enter the faculty of teacher football

 

manager name=messisalary=100

title of an employee manager

 

teacher  details=

name=Ronaldinho

salary=50

faculty=football

Picture for better explanation of the above program-:

Leave a Comment

Your email address will not be published. Required fields are marked *

Do NOT follow this link or you will be banned from the site! Scroll to Top