Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Person{
- string name;
- public:
- Person(string name) {
- this->name;
- }
- virtual string getproces() { return "Exists"; }
- };
- class Student : public Person {
- public:
- Student(string name) : Person(name) { }
- virtual string getproces() { return "Tries to do something usefull"; }
- };
- class Employee : public Student {
- public:
- Employee(string name) : Student(name) { }
- virtual string getproces() { return "work,work,work and again work"; }
- };
- void callProcess(Person& P) {
- cout << P.getproces() << endl;
- }
- int main(){
- setlocale(LC_ALL, "Russian");
- Person p("Yarik");
- Student s("Tolik");
- Employee e("Sanya");
- callProcess(p);
- callProcess(s);
- callProcess(e);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement