initializing mutable class attributes
db3l at fitlinxx.com
Thu Sep 2 01:49:46 CEST 2004
"Dan Perl" <dperl at rogers.com> writes:
> You're right, in most cases that would be the right use. But my example was
> just an example and it was just to enforce the earlier statement of "C++ and
> Java have overloading and then can also mandate a default constructor for a
> parent class."
This point still confuses me, as does the statement it's supposed to
enforce. Your example failed to compile, and the error happened to
reference a missing default constructor, but how does that equate to
mandating such an implementation?
Since I can correct the problem simply by calling the existing
constructor properly from my subclass, clearly I am not _required_ to
implement a default constructor in the base class (which is how I'd
interpret the word "mandate").
C++ may be making an implicit use of such a constructor as part of its
assumptions (and complaining if it doesn't exist), but unless
implementing such a constructor is the only way to satisfy the
compiler, it's not a mandate or requirement that one be provided.
More information about the Python-list