Virtual function issue.
"Kamal" <[email protected]>
| Newsgroups | gmane.comp.lib.boost.langbinding |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I have created a Python wrapper using a custom smart pointer that is defined
in the following manner:
class_<EventWrapper, noncopyable, Ptr<EventWrapper>>("Event", init<>())
.def("f", &Event::f, &EventWrapper::default_f).
implicitely_convertible<Ptr<EventWrapper>, Ptr<Event>>();
register_ptr_to_python<Ptr<Event>>();
Now... when I subclass this in Python like so:
class MyEvent(Event):
def f(self):
return 42
I can use MyEvent as expected only within Python code... when I pass an
instance of MyEvent to C++,
and then C++ passed back MyEvent back to Python, I no longer am able to call
the overridden method f
in Python. Calling f in Python invokes Event::f, as opposed to MyEvent.f
This only happens when I construct MyEvent in Python code, pass the instance
to some C++ code, and have
the C++ code pass back the MyEvent instance back to Python.
Any ideas why this may be?
Thanks.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com