[C++-sig] Beginner - How to extract a Python Class that inherits from C++ Class

Carlos Duran carlos_wurt at zohomail.eu
Sat May 16 03:00:48 EDT 2020


Hi,



I find the solution, first of all I need to add the initializer on the C++ class import:

      

      class_<ComponentWrap, boost::shared_ptr<Component>, boost::noncopyable>("Component", init<>())

      // I additionally added a Holder, but is not necessary.



Then I add the base class initializer on the python class:



      class Derived(DemiWu.Component):

            def __init__(self):

                  DemiWu.Component.__init__(self)



I only find a problem, if a python class call the print function it doesn't work.



Thanks,



Carlos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20200516/1947bd9c/attachment.html>


More information about the Cplusplus-sig mailing list