Le 28/6/15 19:00, Sven Van Caekenberghe a écrit :
On 28 Jun 2015, at 17:59, Max Leske <[email protected]> wrote:


On 28 Jun 2015, at 17:22, stepharo <[email protected]> wrote:

Hi guys

is there a real reason for Stack being a subclass of LinkedLink?
1. You don’t need to adjust an internal data structure (grow, shrink, move, 
sort) to update the stack but only move references.
But it is used in practice?
Because Stack could use a LinkedList and you get the same benefits and not stupid methods that do not make sense for Stack.

2. The interface is pretty similar

No there are not :)
Stack is push pop top not insert after:.....
or this is a strange stack.
3. It is an implementation detail/technique, it is indeed not as if Stack is-a 
LinkedList (from that point of view it is confusing)

What I mean is that this is not good to have subclassing when we can use subclassing.
We remove the fact that Dictionary is a subclass of Set for this reason.


Stef






Reply via email to