Hi all,<br>I have a problem regarding inheritance/polymorphism which I cannot get to the bottom of it.<br>In C++ I have a pure virtual class, lets called it an interface, called "its" and an implementation of it called "ts".
<br>I exposed the two to python using the "wrapper.hpp" module.<br><br>struct ts_wrapper : its, wrapper<its><br>{<br>int get_numdates() const {....}<br>}<br><br>typedef boost::shared_ptr<its> ITS;
<br>register_ptr_to_python<ITS>();<br><br>class_<ts_wrapper, boost::noncopyable>("itimeserie", "Time serie interface")<br> .def("get_numdates", pure_virtual(&its::get_numdates));
<br><br>class_<ts, bases<ts_wrapper>>("timeserie", "An implementation of itimeserie", init<const list&,const dict&>());<br><br>def("ts_create",&timeserieFactory::Create,"Get a time serie");
<br><br><br>timeserieFactory returns a smart pointer to the interface "its", ITS.<br><br>Now, in Python, when I create an instance of "timeserie" using the "ts_create" everything works fine,
i.e. I can call the method "get_numdates" without any problem. However when I create an instance of "timeserie" using the constructor, the object is constructed correctly but when I call "get_numdates" this is what python think about it
<br><br>Boost.Python.ArgumentError: Python argument types in<br> itimeserie.get_numdates(timeserie)<br>did not match C++ signature:<br> get_numdates(class ts_wrapper {lvalue})<br> get_numdates(class its {lvalue})
<br><br>somehow when I use the constructor, the instance is not recognized as derived from the interface.<br>Luca<br><br>