whOOPs

by chromatic

Here's a quote from p. 586 of one of our books:

Polymorphism is when a subclass "stands in" for its superclass.

10 points to everyone who can tell me what's right about that statement as well as what's wrong with it.


7 Comments

Aristotle Pagaltzis
2007-05-07 17:47:15

Haven’t you gotten tired of that particular soapbox yet? :-)


(Polymorphism is when one class can stand in for any of an unbounded set of others, but it is not limited to inheritance.)

Michael Burns
2007-05-07 18:09:12
Right: Polymorphism is spelled correctly.
Wrong: The definition is for Inheritance.
joeblow
2007-05-07 18:14:56
the "stands in" description is OK, but a polymorphic function just needs to implement some interface, not be a subclass of an object?
humouuuur?
2007-05-08 00:00:24
Wrong: Polymorphism - when parrot changes into a parakeet.


Right: TMTOWTDI


mrgumby
2007-05-11 01:56:22
What is wrong with it: an object instantiated from the subclass "stands in" -- not the sub class itself.
What is right with it: the subclass might override a virtual method.
Ken Williams
2007-05-11 19:35:22
Right: it's indeed on page 586.
Wrong: definitions do not go "a /thing/ is when ...". A thing is not when.
chromatic
2007-07-28 09:59:05
Whoops, I meant to respond to this ages ago. Aristotle, Michael, and joeblow are completely right. Ken is right in another way. mrgumby is correct to a degree, but polymorphism doesn't necessarily have anything to do with inheritance.


If it did, neither JavaScript nor Self would work.