[Tutor] Inheritance help

Kent Johnson kent37 at tds.net
Thu Jul 3 04:20:05 CEST 2008

On Wed, Jul 2, 2008 at 9:05 PM, Alan Gauld <alan.gauld at btinternet.com> wrote:
> "sean_mcdaniel" <sean.m.mcdaniel at gmail.com> wrote
>> I am having problems with classes and subclasses. Do the different
>> __init__
>> statements have to have different argument lists?
> You got the solution to your specific question but to answer
> your more pholosophical one:
> sub classes should ideally have the same signature as their
> superclass (the Liskov Substitution Principle or LSP). In other
> words you should be able to plug a sub class in anywhere that the
> superclass can be used.
> This implies that depending on language provisions) your
> sub class should have
> a) one constructor with the same signature as the superclass

Hmm. I don't understand the LSP to make any requirements on the
constructors. It says that instances of a subclass should be
substitutable for instances of the base class, it doesn't say anthing
how the instances are created.

BTW  those wondering what we are talking about might be interested in
this paper:


More information about the Tutor mailing list