-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpure.h
executable file
·92 lines (78 loc) · 1.43 KB
/
pure.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
* pure.h
*
* Created on: 2011-8-23
* Author: kevinguo
*/
#ifndef PURE_H_
#define PURE_H_
#include <iostream>
class pure {
public:
pure();
virtual std::string getName() const = 0;
virtual ~pure();
};
class CollegeFrind : public pure {
public:
CollegeFrind():pure() {}
std::string getName() const {
return "guopeng";
}
};
class bear {
public:
bear(int _wei):weight(_wei) {}
int getWeight() const {
return weight;
}
void Print() {
printf("in bear::Print()\n");
}
private:
int weight;
};
class danger {
public:
danger(int _num) : leave_num(_num) {}
int getNum() const {
return leave_num;
}
void Print() {
printf("in danger::Print()\n");
}
void Print(int with_arg) {
printf("in danger::Print(int with_arg)\n");
}
private:
int leave_num;
};
class panda : public bear, public danger {
public:
panda(int _wei, int _num) : bear(_wei), danger(_num) {}
void localFunc() {
printf("in panda::localFunc()\n");
}
};
class Base {
public:
Base():m_data(0) {
// Initlation();
}
virtual void Initlation() {
m_data = 10;
printf("in Base::Initlation()\n");
}
virtual ~Base() {}
private:
int m_data;
};
class Derived : public Base {
public:
Derived() {}
virtual void Initlation() {
printf("in Derived::Initlation()\n");
}
virtual ~Derived() {}
};
#endif /* PURE_H_ */