Last change
on this file since 45 was
29,
checked in by landauf, 17 years ago
|
updated boost from 1_33_1 to 1_34_1
|
File size:
806 bytes
|
Line | |
---|
1 | /* Copyright Bruno da Silva de Oliveira 2003. Use, modification and |
---|
2 | distribution is subject to the Boost Software License, Version 1.0. |
---|
3 | (See accompanying file LICENSE_1_0.txt or copy at |
---|
4 | http:#www.boost.org/LICENSE_1_0.txt) |
---|
5 | */ |
---|
6 | namespace virtual_ { |
---|
7 | |
---|
8 | struct C |
---|
9 | { |
---|
10 | public: |
---|
11 | virtual int f() |
---|
12 | { |
---|
13 | return f_abs(); |
---|
14 | } |
---|
15 | |
---|
16 | virtual void bar(int) {} |
---|
17 | virtual void bar(char*) {} |
---|
18 | |
---|
19 | const char* get_name() |
---|
20 | { |
---|
21 | return name(); |
---|
22 | } |
---|
23 | virtual int dummy() { return 0; } |
---|
24 | |
---|
25 | protected: |
---|
26 | virtual int f_abs() = 0; |
---|
27 | |
---|
28 | private: |
---|
29 | virtual const char* name() { return "C"; } |
---|
30 | }; |
---|
31 | |
---|
32 | struct D |
---|
33 | { |
---|
34 | virtual int dummy() { return 0; } |
---|
35 | }; |
---|
36 | |
---|
37 | inline int call_f(C& c) { return c.f(); } |
---|
38 | inline int call_dummy(C* c) { return c->dummy(); } |
---|
39 | inline int call_dummy(D* d) { return d->dummy(); } |
---|
40 | |
---|
41 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.