[C++-sig] Calling overidden pure virtual function from C++ side
William Marié
william.marie at gmail.com
Thu Aug 21 19:22:31 CEST 2008
Hi,
I have a little problem using a pure virtual function exposed to the python
and called from the c++ :
In C++ :
--------------------------
class A
{
virtual void foo() = 0;
void bar()
{
foo();
}
}
struct AWrap : A, bp::wrapper
{
void foo()
{
this->get_override( "foo" );
}
};
BOOST_PYTHON_MODULE(dum)
{
bp::class_<AWrap,boost::noncopyable>( "A" )
.def( "foo", bp::pure_virtual( &A::foo ) )
.def( "bar", &A::bar )
;
}
In Python :
--------------------------
import dum
class B( dum.A ) :
def foo :
print "Foo from B"
b = B()
b.bar()
So here b.bar() never prints "Foo from B"
Does anyone could tell me what am i doing wrong ?
Thanks
William
--
View this message in context: http://www.nabble.com/Calling-overidden-pure-virtual-function-from-C%2B%2B-side-tp19093207p19093207.html
Sent from the Python - c++-sig mailing list archive at Nabble.com.
More information about the Cplusplus-sig
mailing list