-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
44 lines (37 loc) · 840 Bytes
/
main.cpp
File metadata and controls
44 lines (37 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// 2018556502 Muhammed Ali ARICI
// 2019556461 Mahmut Can ÇINGI
// 2020556061 Emre ULUSOY
/* Multiple inheritence occurs ambigious error. To solve this, we should use scope resolution operator (::) or virtual base class */
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
class people {
public:
char name[20];
};
class staff : virtual public people {
public:
int i = 3;
};
class manager : virtual public people {
public:
int j = 8;
};
class lecturer : public manager, public staff {
public:
void set(char *a) { strcpy(name, a); }
void get() {
cout << "Lecturer name: " << name << endl
<< "Number of managers: " << j << endl
<< "Number of staff: " << i << endl;
}
};
int main() {
lecturer ob;
ob.i = 1;
ob.j = 6;
ob.set("aaa bbb");
ob.get();
return 0;
}