forked from Dashark/hello-world
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTeachStudent.cpp
54 lines (51 loc) · 859 Bytes
/
TeachStudent.cpp
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
45
46
47
48
49
50
51
#include <iostream>
using namespace std;
int main() {
std::cout << "Hello World!" << std::endl;
for(int i = 0; i < 100; i++)
sum += i;
}
class Human {
public:
virtual void learn() = 0;
virtual void teach() = 0;
};
class Student:public Human {
public:
Student() {
}
~Student() {
}
virtual void learn() {
//do something
}
virtual void teach() {
//do nothing
}
};
class Teacher:public Human {
Human *students[54];
public:
Teacher() {
students[0] = new Student();
students[1] = new Student();
}
~Teacher() {
delete[] students;
}
virtual void teach() {
//do something
}
virtual void learn() {
//do nothing
}
};
template<class Type1, class Type2> //General Programming
class Room { //ÈÝÆ÷ container
Type1 *ts1[];
Type2 *ts2[]
};
int main() {
Room<Human, Furniture> classroom;
Room<Boss, Commidy> supermarket;
}