SWIG and abstract base class
Luigi Ballabio
ballabio at mac.com
Thu Mar 7 13:08:48 EST 2002
At 08:01 AM 3/7/02 -0800, Helmut Zeisel wrote:
>I want to use SWIG to create a Python module for
>a C++ class hierarchy using abstract base classes:
Helmut,
I'm assuming that you're using a reasonably recent version of SWIG
(let's say >= 1.3.9).
If you actually tell SWIG that Base is abstract (e.g., if you declare
purely abstract methods as such, with the = 0 at the end) it should not try
to instantiate it. If you don't want to expose the purely abstract methods
or the above doesn't work in some way, you should be able to inhibit
instantiation by declaring Base to SWIG as:
class Base {
private:
Base();
public:
// whatever
};
hope this helps,
Luigi
More information about the Python-list
mailing list