Advertisement
Josif_tepe

Untitled

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