SWIG and abstract base class

Helmut Zeisel helmut.zeisel at aon.at
Thu Mar 7 11:01:26 EST 2002


I want to use SWIG to create a Python module for
a C++ class hierarchy using abstract base classes:

%module mymodule

%{
#include "base.h"
#include "derived1.h"
...
%}

class Base // Abstract base class
{
public:
  // many common methods
  ..
};

class Derived1 public Base
{
public:
  // special methods
  ..
};

In the created C++ code, I get error messages like

"cannot instantiate abstract class due to following members:"

Is there any possibility to tell SWIG that
Base should be treated as abstract class?

What could be a workaround (except of repeating
all the base class methods in every derived class)?

Helmut



More information about the Python-list mailing list