mirror of
https://github.com/boostorg/python.git
synced 2026-01-23 05:42:30 +00:00
- Fixed a inheritance bug, and added a test for it.
[SVN r18251]
This commit is contained in:
@@ -8,6 +8,7 @@ namespace basic {
|
||||
|
||||
struct C
|
||||
{
|
||||
// test virtuallity
|
||||
C(): value(1), const_value(0) {}
|
||||
virtual int f(int x = 10)
|
||||
{
|
||||
@@ -21,11 +22,16 @@ struct C
|
||||
const std::string& name() { return _name; }
|
||||
void set_name(const std::string& name) { _name = name; }
|
||||
std::string _name;
|
||||
|
||||
// test data members
|
||||
static int static_value;
|
||||
static const int const_static_value;
|
||||
|
||||
int value;
|
||||
const int const_value;
|
||||
|
||||
// test static functions
|
||||
static int mul(int x=2, int y=3) { return x*y; }
|
||||
};
|
||||
|
||||
inline int call_f(C& c)
|
||||
|
||||
18
pyste/example/inherit.h
Normal file
18
pyste/example/inherit.h
Normal file
@@ -0,0 +1,18 @@
|
||||
template<typename T>
|
||||
class A
|
||||
{
|
||||
public:
|
||||
void set(T v) { mData = v; }
|
||||
|
||||
T get() const { return mData; }
|
||||
|
||||
private:
|
||||
T mData;
|
||||
};
|
||||
|
||||
|
||||
class B : public A<int>
|
||||
{
|
||||
public:
|
||||
int go() { return get(); }
|
||||
};
|
||||
8
pyste/example/inherit.pyste
Normal file
8
pyste/example/inherit.pyste
Normal file
@@ -0,0 +1,8 @@
|
||||
# Doesn't work:
|
||||
A = Template('A', 'inherit.h')
|
||||
A_int = A('int')
|
||||
|
||||
Class('B', 'inherit.h')
|
||||
|
||||
# Does work:
|
||||
#AllFromHeader('inherit.h')
|
||||
Reference in New Issue
Block a user