an oop question

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Nov 4 03:06:37 EDT 2022


> ram at zedat.fu-berlin.de (Stefan Ram) writes [that Barbara Liskov said]:
> 
>> |If for each object o1 of type S there is an object o2 of
>> |type T such that for all programs P defined in terms of T,
>> |the behavior of P is unchanged when o1 is substituted for o2
>> |then S is a subtype of T.

That seems overly restrictive, because it wouldn't allow S to
override a method of T and make it do something different --
which we do all the time in practice.

>> Class contracts must hold for subclasses.

That sounds like a much better way of saying it!

-- 
Greg


More information about the Python-list mailing list