SWIG - C++ - Inheritance

news1.sympatico.ca mtremblay at golemlabs.com
Tue Oct 1 09:35:56 EDT 2002


> > Thanks for the answer, the problem that I see then is that my CThread
> class
> > is an abstract class since it has a pure virtual function, and when Swig
> > notices a pure virtual function, it defines the constructor as the
> following
> > :
> >
> >     def __init__(self): raise RuntimeError, "No constructor defined"
>
> Ooh, that's bad! How can you ever construct the C++ instance data you
need?
> I guess you'd better ask the SWIG people about this; I'm out of my depth
> here.
>
> If you don't have too much invested in SWIG you could switch to
> Boost.Python, which handles abstract classes fairly smoothly. A pure
virtual
> function just means that you'll get an AttributeError if you try to use
> /that function/ without implementing it.
>
> --
> -----------------------------------------------------------
>            David Abrahams * Boost Consulting
> dave at boost-consulting.com * http://www.boost-consulting.com


Ok, thanks a lot for the help David, I'll ask SWIG about this... and I will
take a closer look at Boost.Python :)

    Mathieu Tremblay








More information about the Python-list mailing list