All pastes #2108566 Raw Edit

Miscellany

public cpp v1 · immutable
#2108566 ·published 2012-02-01 09:42 UTC
rendered paste body
#include <iostream>#include <string>using namespace std;class Person {private:	string name;public:	Person(string name){		this->name = name;	}	string get_name(){		return name;	}	virtual void introduce(string name) = 0;};class Teacher : virtual public Person {private:	double selary;public:	Teacher(string name, double selary):Person(name){		this->selary = selary;	}	void introduce(string name){		cout << "Hello, I`m a teacher. My name is " << name << endl;	}};class Student : virtual public Person {private:	double studentship;public:	Student(string name, double studentship):Person(name){		this->studentship = studentship;	}	void introduce(string name){		cout << "Hello, I`m a student. My name is " << name << endl;	}};class Assistant : public Teacher, public Student {private:	int classes;public:	Assistant(string name, double selary, double studentship, int classes):Teacher(name, selary), Student(name, studentship){		this->classes = classes;	}	void introduce(string name){		cout << "Hello, I`m an Assistant. My name is " << name << endl;	}};int main() {	Teacher F1("V.Georgieva", 1050);	F1.introduce(F1.get_name());	Student B1("V.Nguyen", 60);	B1.introduce(B1.get_name());	Assistant C1("I.Stankov", 700, 90, 10);	C1.introduce(C1.get_name());	return 0;}