C++ program to illustrate Multilevel Inheritance

MULTILEVEL INHERITANCE

AIM:
A program to illustrate multilevel inheritance. we have three classes, student, test and result. Here class student is the base class. And the class test is derived from the base class student. And the another class result is derived from the class test.

ALGORITHM:

• Start the process
• Invoke the base class student
• Invoke the derived class test which in inherited by the class student
• Invoke the derived class result which in inherited by the class test
• Create an object student1 for the result class
• Call student1.getno(),assign the value of rno in student class
• Call student1.getmarks(),assign the marks in test class
• Call student1.display(),for displaying the result
• Stop the process

PROGRAM

#include
#include
class student
{
   		protected:
   		int rno;
   		public:
   		void getno(int);
   		void putno(void);
};
void student::getno(int a)
{
rno=a;
}
void student ::putno()
{
cout<<"rollno="<
	
Editorial Team
Editorial Team

We are a group of young techies trying to provide the best study material for all Electronic and Computer science students. We are publishing Microcontroller projects, Basic Electronics, Digital Electronics, Computer projects and also c/c++, java programs.

13 thoughts on “C++ program to illustrate Multilevel Inheritance

  1. if derived class 2 is inherited privately!!!
    then
    can we make an object of that class (derived class 2) in the MAIN() ?????

Leave a Reply

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

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in