[C++-sig] problems with embedded python and pure virtual functions
Birgir Sigurjonsson
birgir-s at online.no
Thu Jan 4 14:49:12 CET 2007
Hei here is the python code:
from import_framework import AbstractLoader, AbstractLoaderFactory
print 'Python running: --> Ascii135Loader script'
class Ascii135Loader(AbstractLoader):
def __init__(self):
super(Ascii135Loader, self).__init__()
print self.__init__
def load_impl(self):
print 'load_impl -- doing som hard work'
return True
class Ascii135LoaderFactory(AbstractLoaderFactory):
def __init__(self, key):
super(Ascii135LoaderFactory, self).__init__(key)
print 'Python running: 4--> Ascii135LoaderFactory(AbstractLoaderFactory) __init__'
print self.__init__
def make(self):
print 'Python running: 5--> Ascii135LoaderFactory::make'
return Ascii135Loader()
register_this = Ascii135LoaderFactory("Ascii135")
And I can see that the AbstractLoader constructor is called because I have
a print out there
Best regards,
Birgir.
>
> Roman Yakovenko wrote:
> > On 1/4/07, Birgir Sigurjonsson <birgir-s at online.no> wrote:
> >
> >>Hi, I am having problem calling a pure virtual function that
> >>is overritten in Python. My apology, if this post is to long
> >>but I am not sure how to formulate my question nor do I know
> >>what part of my code is needed to for you all to help me.
> >>
> >>I can create my AbstractLoader and call its load function.
> >>But then load calls load_impl I get Abort in the console.
> >>
> >
> >
> > The most important part of the code is missing. In most cases ( 99% ) the
> > main reason is that the derived class, defined in Python, did not call __init__
> > method of base class, defined in C++.
> >
>
More information about the Cplusplus-sig
mailing list