Why does the StackLinkedList class inherit the LinkedList class?

Skill/Topic: Stacks using Linked List
A) StackLinkedList class uses different attributes and member functions of the LinkedList class.
B) StackLinkedList class uses same attributes and member functions of the LinkedList class.

Showing Answers 1 - 6 of 6 Answers

abhirup_ju

  • Jan 21st, 2008
 

Actually the stack class does not inherit linked list class. If inheritence exists then insertbefore() , insertafter(), insertstposition(), deletenode().... these functions will be available in the stack class which is not desirable. And Here the relation between stack and linked list is a "has a" relation not a "is a" ralation...  

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions