Skip to main content
summaryrefslogtreecommitdiffstats
blob: 9c218bf5bcec2099430e875b879f93bcb38ac885 (plain) (blame)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
class Class1 {
public:
	double normalMethod(int p1, char p2, float p3);
	virtual void inheritedMethod();
	virtual void pureVirtualMethod() = 0;
	virtual void overriddenMethod();

	void noExceptionSpecMethod();
	void emptyExceptionSpecMethod() throw();
	void nonEmptyExceptionSpecMethod() throw(int);

	inline int inlineMethod();
	static int staticMethod();
	int varArgsMethod(...);
	int constMethod() const;
	int volatileMethod() volatile;
	int constVolatileMethod() const volatile;

	// Here, const/volatile applies to the return value, not the method
	const int *notConstMethod();
	volatile int *notVolatileMethod();
	const volatile int *notConstVolatileMethod();

	Class1();
	virtual ~Class1() = 0;
};

struct A {
	A();
	A(const A&) throw();
	~A() throw(int);
};

struct B {
	B() throw();
	B(const B&) throw();
	~B() throw(double);
};

struct D : public A, public B {};

class Class2 : public Class1 {
public:
	void pureVirtualMethod();
	void overriddenMethod();
	void overloadedMethod();
	void overloadedMethod(int p1);

	Class2();
	~Class2();
};

double Class1::normalMethod(int p1, char p2, float p3) {
}

void Class1::inheritedMethod() {
}

void Class1::overriddenMethod() {
}

void Class2::pureVirtualMethod() {
}

void Class2::overriddenMethod() {
}

void Class2::overloadedMethod() {
}

void Class2::overloadedMethod(int p1) {
}

Class1::Class1() {
}

Class1::~Class1() {
}

Class2::Class2() {
}

Class2::~Class2() {
}

class Class3 {
	int defaultMethod();
private:
	void privateMethod();
protected:
	char protectedMethod();
public:
	double publicMethod();
};

int main() {
	Class2 c2;

	Class1 *pc1 = &c2;
	Class2 *pc2 = &c2;

	pc1->inheritedMethod();

	pc1->pureVirtualMethod();
	pc1->pureVirtualMethod();

	pc1->overriddenMethod();
	pc1->overriddenMethod();
	pc1->overriddenMethod();

	c2.inheritedMethod();
	pc2->inheritedMethod();

	c2.pureVirtualMethod();
	c2.pureVirtualMethod();
	pc2->pureVirtualMethod();

	c2.overriddenMethod();
	c2.overriddenMethod();
	c2.overriddenMethod();
	pc2->overriddenMethod();

	c2.overloadedMethod();
	pc2->overloadedMethod();

	c2.overloadedMethod(1);
	c2.overloadedMethod(1);
	pc2->overloadedMethod(1);

	return 0;
}

Back to the top