[C++-sig] Wrap a virtual function which returns a raw pointer

Robert Smallshire Robert.Smallshire at roxar.com
Thu Dec 21 22:10:04 CET 2006


>> What are AbstractLoader, AbstractLoaderFactory?
>> The class names you exposed are AL and ALFactoy?

>> The class names you exposed are AL and ALFactory

Yes, sorry. The effort to extract a readable, fairly minimal example, gone wrong.

AL == AbstractLoader
ALFactory == AbstractLoaderFactory

>> class Ascii135Loader(AbstractLoader):
>>      def __init__(self):
>>          print self.__init__

> Here you have to call to AbstractLoader __init__ method. This is a must.

Of course. Silly omission.

>>
>>
>> class Ascii135LoaderFactory(AbstractLoaderFactory):
>>      def __init__(self, key):
>>          super(Ascii135LoaderFactory, self).__init__(key)

> Why do you use super here?
> AbstractLoaderFactory.__init__(self, key) should work.

True enough, and either is fine. Use of super() is habit, encouraged by following some guidelines <http://wiki.osafoundation.org/bin/view/Projects/UsingSuper <http://wiki.osafoundation.org/bin/view/Projects/UsingSuper> >, with future subclassing in mind.

Rob





DISCLAIMER:
This message contains information that may be privileged or confidential and is the property of the Roxar Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20061221/05e00dfa/attachment.htm>


More information about the Cplusplus-sig mailing list