blob: 67625b5edd0a0660a36d76c7c465e7269752b15b (
plain)
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
|
File example.h
==============
::
#include <iostream>
#include <vector>
class AbstractClass {
public:
virtual ~AbstractClass() {}
virtual void abstract_method() = 0;
};
class ConcreteClass : AbstractClass {
public:
ConcreteClass(int n=42) : m_int(n) {}
~ConcreteClass() {}
virtual void abstract_method() {
std::cout << "called concrete method" << std::endl;
}
void array_method(int* ad, int size) {
for (int i=0; i < size; ++i)
std::cout << ad[i] << ' ';
std::cout << std::endl;
}
void array_method(double* ad, int size) {
for (int i=0; i < size; ++i)
std::cout << ad[i] << ' ';
std::cout << std::endl;
}
AbstractClass* show_autocast() {
return this;
}
operator const char*() {
return "Hello operator const char*!";
}
public:
int m_int;
};
namespace Namespace {
class ConcreteClass {
public:
class NestedClass {
public:
std::vector<int> m_v;
};
};
} // namespace Namespace
|