[Python-Dev] Breaking calls to object.__init__/__new__
"Martin v. Löwis"
martin at v.loewis.de
Thu Mar 22 16:17:49 CET 2007
Greg Ewing schrieb:
> Blake Ross wrote:
>> C++ ensures that virtual bases
>> are only constructed once,
> As far as I remember, C++ ensures this by not calling
> the base constructors automatically at all, leaving
> you to explicitly call the constructors of all the
> virtual bases that you inherit.
That's not true. A virtual base constructor is always
called directly from the most-specific constructor
(i.e. from the constructor of the object being created).
If no explicit base constructor call is present in that
constructor, an implicit call to the default constructor
So if the base class does not have a default constructor,
you indeed need to explicitly add a constructor call into
More information about the Python-Dev