1 | #include <stdio.h> |
2 | |
3 | template <class T> class A |
4 | { |
5 | public: |
6 | void accessMember(T a); |
7 | T accessMemberConst() const; |
8 | static int accessStaticMember(); |
9 | |
10 | void accessMemberInline(T a) __attribute__ ((always_inline)) |
11 | { |
12 | m_a = a; // breakpoint 4 |
13 | } |
14 | |
15 | T m_a; |
16 | static int s_a; |
17 | }; |
18 | |
19 | template <class T> int A<T>::s_a = 5; |
20 | |
21 | template <class T> void A<T>::accessMember(T a) |
22 | { |
23 | m_a = a; // breakpoint 1 |
24 | } |
25 | |
26 | template <class T> T A<T>::accessMemberConst() const |
27 | { |
28 | return m_a; // breakpoint 2 |
29 | } |
30 | |
31 | template <class T> int A<T>::accessStaticMember() |
32 | { |
33 | return s_a; // breakpoint 3 |
34 | } |
35 | |
36 | int main() |
37 | { |
38 | A<int> my_a; |
39 | |
40 | my_a.accessMember(a: 3); |
41 | my_a.accessMemberConst(); |
42 | A<int>::accessStaticMember(); |
43 | my_a.accessMemberInline(a: 5); |
44 | } |
45 | |