|
Re: Extends is evil?
"Guillermo Schwarz" <guillermo_schwarz@hotmail.com> wrote in message
news:3f38e49d@news.totallyobjects.com...
> "Peter van Rooijen" <peter@vanrooijen.com> escribió en el mensaje
> news:3f3407e0$0$49115$e4fe514c@news.xs4all.nl...
> > "panu" <panu@fcc.net> wrote in message
> > news:Se6dncTW1r_jQ6-iU-KYgw@fcc.net...
> > > bluke wrote:
> > > > What do smalltalkers think
> > > > about implementation inheritance?
> >
> > [snip]
> >
> > It seems that there is some confusion over what the term "implementation
> > inheritance" actually means.
> >
> > Implementation inheritance refers to the situation where one class
> inherits
> > another, without a resonable subtyping relationship between the two.
> >
> > An example would be to think that a chess club is a set of people, and
> > translating that into defining a class ChessClub that inherits Set.
>
> Why? It has a set of people, why would that be a problem?
Guillermo,
That is a great question which has a great answer, which I am not going to
give you here :-).
> I think implementation inheritance is when a Dog is a Name, because
instead
> a Dog should have a Name.
That is also an example of "implementation inhertitance".
> or a more real example: a Dog is a Cat that barks
> instead of meows, so meow() calls bark().
I've never seen code with such classes, much less it being called a "real
example". Now I am sure you are kidding.
Regards,
Peter van Rooijen
Amsterdam
> > This is a mistake.
> >
> > And don't laugh at the example, I've seen code doing such things by
> > programmers who were paid to write it (I've changed the example to
protect
> > the guilty ;-)).
|