[C++-sig] Re: call_f(Derived) did not match C++ signature
Shin-ichi MORITA
shin1_morita at yahoo.co.jp
Thu Jun 10 17:51:54 CEST 2004
Sorry, I sent incomplete message.
> Writing this, I've just found the cause.
> I exposed Base in foo.cc:
class_<Base, BaseWrap, boost::noncopyable>("Base",
no_init);
and defined Derived in test_foo.py:
class Derived(Base):
def __init__(self):
pass # because I exposed with no_init.
def f(self):
return 42
This is wrong.
Next I removed "no_init" and "__init__" above like this:
class_<Base, BaseWrap, boost::noncopyable>("Base");
class Derived(Base):
# Base.__init__ will be called.
def f(self):
return 42
Finally I got *passed*.
Base.__init__ must be called to initialize Derived
instance correctly, is this right?
If so, I think that "no_init" is not for abstract base
class, but just for only noncreatable class.
Why dose this page in the tutorial uses "no_init" to
explain abstract base class?
http://boost.org/libs/python/doc/tutorial/doc/class_virtual_functions.html
Thanks.
__________________________________________________
Do You Yahoo!?
http://bb.yahoo.co.jp/
More information about the Cplusplus-sig
mailing list