You are indeed correct -- I just needed to add a virtual method to the base
class. As it turns out this wasn't the problem I was originally having in our
application, so my attempt at creating a small sample of the problem wasn't
complete.
My project's code was failing for what turned out to be
On 01/12/2011 12:06 PM, Matt Bendiksen wrote:
Thanks Jim, but I still cannot get it to work. I now have it defined as:
def("get_a_or_b_instance", get_a_or_b_instance);
class_ >("A", init<>())
;
class_, bases >("B", init<>())
;
(note I change your example line from
Thanks Jim, but I still cannot get it to work. I now have it defined as:
def("get_a_or_b_instance", get_a_or_b_instance);
class_ >("A", init<>())
;
class_, bases >("B", init<>())
;
(note I change your example line from "bases" to "bases")
I tried it with and without:
r
On 01/12/2011 09:03 AM, Matt Bendiksen wrote:
I'm stumped on a problem encountered when trying to return a derived instance
via a shared_ptr to python. The python instance is always shown as a base class
and not the subclass that was created, as if the instance was sliced.
struct A {
I'm stumped on a problem encountered when trying to return a derived instance
via a shared_ptr to python. The python instance is always shown as a base class
and not the subclass that was created, as if the instance was sliced.
struct A {
};
struct B : A {
};