:)
my question was to check if we can change it :)
Le 30/6/15 11:10, Max Leske a écrit :
On 30 Jun 2015, at 11:00, stepharo <[email protected]> wrote:
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.
agreed.
2. The interface is pretty similar
No there are not :)
Stack is push pop top not insert after:.....
or this is a strange stack.
What I meant was: Linked list provides an interface that allows for stack
operations. Not that the naming conventions are the same.
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.
You asked for reasons. I didn’t say they were *good* reasons :)
Stef