Christophe,

You need to work with Wrappers when you export the class A to python.
This wrapper will make sure that when C++ calls a class that you
overloaded in python that then the correct python implementation is
called.

See also the sections:

Class Virtual Functions
Virtual Functions with Default Implementations

of the document that JS Unkn0wn gave you:
http://www.boost.org/doc/libs/1_49_0/libs/python/doc/tutorial/doc/html/python/exposing.html

-Holger
On Thu, Apr 19, 2012 at 00:55, christophe jean-joseph
<jjchristo...@yahoo.fr> wrote:
>
> Hi,
>
> here is my problem.
>
> Let say have a C++ A class and a Ader class in Python, derived from A
> (through boost::python).
> I have a list of functions f_i in Ader overloading the equivalent functions
> with same name in A.
> The main is written in Python and call a method g of a C++ class B passing
> and argument of type Ader (it's written as A type under C++, but I don't
> have any type issue there).
> Let say B::g call a function f_1, calling f_2, calling f_3. The error occur
> at f_3 as I could identify it uses A::f_3 instead of Ader::f_3.
> By going down, I could confirm that, from f_1 to f_3, all the 3 called
> functions are the A version.
> So my question is, how can I fix this issue so that the B::g function uses
> Ader functions (meanning Python functions) and not A functions?
> On a side, this is a C++/Python version of a code working fine when fully
> written in C++.
>
> Christophe Jean-Joseph
>
>
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig@python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to