Miscellany
public text v1 · immutable#include <iostream.h>
class Person
{
protected:
int p;
public:
Person(int x)
{
p = x;
}
};
class Teacher: public Person
{
protected:
int t;
public:
Teacher(int x, int y):Person(y)
{
t = x;
}
};
class Student: public Teacher
{
public:
int s;
public:
Student(int x, int y ):Teacher(x, y)
{
s = t + p;
}
};
int main()
{
Student test(5,6);
cout << test.s << endl;
return 0;
}