2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-21 17:12:22 +00:00
Files
python/pyste/tests/virtual2.h
Bruno da Silva de Oliveira 7ea2ab1672 - If you export a derived class without exporting its base classes, the derived class will explicitly export the bases's methods and attributes. Before, if you were interested in the bases's methods, you had to export the base classes too.
- Added a new function, no_override. When a member function is specified as "no_override", no virtual wrappers are generated for it, improving performance and letting the code more clean.

- There was a bug in which the policy of virtual member functions was being ignored (patch by Roman Sulzhyk).


[SVN r18814]
2003-06-17 01:34:26 +00:00

30 lines
443 B
C++

namespace virtual2 {
struct A
{
virtual int f() { return 0; }
virtual int f1() { return 10; }
virtual A* make_new() { return new A; }
};
struct B: A
{
virtual int f() { return 1; }
virtual int f2() { return 20; }
virtual A* make_new() { return new B; }
};
inline int call_fs(A*a)
{
int r = a->f1();
B* b = dynamic_cast<B*>(a);
return r + b->f2();
}
inline int call_f(A* a)
{
return a->f();
}
}