MULTILEVEL INHERITANCE
Program
#include “iostream.h”
#include “conio.h”
class stu
{
protected:
char roll[20];
public:
void getdata();
void putdata();
};
class test:public stu
{
protected:
float sub1,sub2;
public:
void getmark();
void dismark();
};
class result:public test
{
float total;
public:
void display()
{
total=sub1+sub2;
putdata();
dismark();
cout << "\n\ntotal" <<>> roll;
}
void stu::putdata()
{
cout << "\n\n ROLL NUMBER:" <<>> sub1;
cout << "\n\n ENTER THE SUBJECT 2 MARK:"; cin >> sub2;
}
void test::dismark()
{
cout << "\n\n SUBJECT 1 MARK" << size="5">Output
ENTER THE ROLL NUMBER : 1234
ENTER THE SUBJECT 1 MARK : 89
ENTER THE SUBJECT 2 MARK :97
ROLL NUMBER :1234
SUBJECT 1 MARK :89
SUBJECT 2 MARK :97
TOTAL :186