Describe about Multi-Level inheritance

Multilevel inheritance-:

Multi-level inheritance is the type of inheritance in which derived class is formed from already derived class.

How to write this program?

Step 1) Make a Base class(name it class Main)

Step 2) Make a derived class of the first base class(name it class Derived 1)

Step 3) Make another derived class of class Derived 1.

 

 

Source Code-:

 

 

Output-:

enter the name neymar

enter the roll 100

enter the marks in subject1 and subject2 50

100

name=neymar

roll=100

marks of subject1=50

marks of subject2=100

total marks=150

 

As said in “how to write this program”, we have

Step 1) Created a “‘student” class.

Step 2) Create a “test” class derived from “student” class.

Step 3) Create a “result” class derived from “test” class.

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