I have some C++ I have exposed to Python through SWIG. In there is a base class with a single pure virtual function.
In Python, I import my module and define a class that uses the abstract class as base.
import mymodule
class Foo(mymodule.mybase):
...
In that module is also a manager class, I want to add my new defined class to the manager.
m = mymodule.mymanager()
m.add(Foo())
Definition of add:
void add(mybase* b) { ... }
Didn't work as I would expect:
TypeError: in method 'mymanager_add', argument 2 of type 'mymodule::mybase *'
What did I miss? It seems it's not sure that my Foo class is a "mybase". I tried adding a call to the base class constructor in Python but that didn't work, said the class was abstract.
def __init__(self):
mymodule.mybase.__init__(self)