[C++-sig] Inheritance and __init__

Bue Vedel-Larsen bue.longbow at gmail.com
Wed Oct 31 13:57:44 CET 2007

"English, Mark" <Mark.English at rbccm.com> wrote in
news:EE7D40281B517A41AF5A90847A61F27947F8CE9E at SEW39051.oak.fg.rbc.com: 

>> But why is this necessary? The pure Python example works 
>> without explicitly calling the __init__ method of the Base 
>> class. Do my class_ definition of the module lack something?
> As far as I know, the Python code working is undefined behaviour.
> Whenever overriding __init__() (especially for new style classes which
> Boost Python class_ instances implicitly are), call the base class
> __init__() passing through arguments as necessary.
> If you don't do this, the __init__ of the base class won't get called
> which for Boost Python is bad news.

Ah, ok. Thanks for clearing that up.


More information about the Cplusplus-sig mailing list