Advertisement
Josif_tepe

Untitled

May 12th, 2021
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. class Person {
  5. public:
  6.     Person(int x) {
  7.         cout << "Person constructor" << endl;
  8.     }
  9. };
  10. class Student : public Person {
  11. public:
  12.     Student(int x) : Person(x) {
  13.         cout << "Student constructor" << endl;
  14.     }
  15. };
  16. class Professor : public Person {
  17. public:
  18.     Professor(int x) : Person(x) {
  19.         cout << "Professor constructor" << endl;
  20.     }
  21. };
  22. class Faculty : public Student, public Professor {
  23. public:
  24.     Faculty(int x) : Student(x), Professor(x) {
  25.         cout << "Faculty" << endl;
  26.     }
  27. };
  28. int main() {
  29.     Faculty f(10);
  30.     return 0;
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement