Re: isa
Re: isa
- Subject: Re: isa
- From: Marco Scheurer <email@hidden>
- Date: Mon, 3 Jun 2002 14:34:58 +0200
On Monday, June 3, 2002, at 01:41 pm, Ondra Cada wrote:
On Monday, June 3, 2002, at 05:48 , Aram Greenman wrote:
However, if A' inherits from A, saying an A' is an instance of A _is_
correct, insofar as it has all the instance variables of A and
therefore possesses everything that makes an A an A.
Wrong again. Well, the properties would be there, but can be obsoleted
in A' -- not used anymore, the same functionality encapsulated into a
different set of properties altogether.
Right and wrong I would say.
Right, because in a reasonable design it is true that one should be able
to say that an instance of A' can be viewed as an instance of an A. It
is considered harmful for a subclass to violate expectations of its
superclass. This is of course the Liskov Substitution principle, which
is a good design heuristic, and the basis of design by contract.
Wrong, because this only apply to the public properties, of which
instance variables are generaly excluded. So even if it is true that an
instance of A' will include all instance variables declared in A, it may
not a good idea to access them, since their usage could have been
completely changed or obsoleted as Ondra said.
Marco Scheurer
Sen:te, Lausanne, Switzerland
http://www.sente.ch
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
- Follow-Ups:
- Re: isa
- From: Marcel Weiher <email@hidden>
References: | |
| >Re: isa (From: Ondra Cada <email@hidden>) |