All pastes #441881 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-04-15 22:03 UTC
rendered paste body
#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;
}