To preserve polymorphism, don't add methods to subclasses which aren't in their superclass.
Originally posted by Gavin Tranter:
Isnt polymorphism by definion achieved at runtime?
So no matter how many methods you add to a subtype, if you reference it by its supertype you will never be able to access those more specialised methods (without a cast).
I am learning new things, and as you can see I am not affarid to question and hold up my current understand when I come across something "new" or that seems to challenge what I thought I knew.
For example, what if you extended LinkedList and made the size() method always return 1? .....