[Tutor] Calling method in parent class

spir denis.spir at free.fr
Tue May 12 18:40:12 CEST 2009


Le Tue, 12 May 2009 07:27:52 -0400,
Kent Johnson <kent37 at tds.net> s'exprima ainsi:

> I don't agree with this at all. It's not at all unusual for a derived
> class to override a base class method in order to add additional
> functionality to it, then to call the base class method to complete
> the implementation. __init__() is the most common example but not the
> only one. I don't consider this a design flaw at all. 

Aside __init__, it's also common when overloading operators. One often needs the logic implemented in the base class to process the operation on instances of sub classes.
There's also the case of delegation.

Denis
------
la vita e estrany


More information about the Tutor mailing list