• Post Reply Bookmark Topic Watch Topic
  • New Topic

Implement DLL as a subclass of SLL, reusing of code  RSS feed

 
kat hok
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody! I have an exercise at school that I don't get. Wrote down all the code that I've got, to make it easier for you to understand.

My questions are;

1. If I implement DLL as a subclass of SLL, with the purpose of reusing code and without modifying anything in the sll package, which method could not be reused?
2. How can I modify the implementation of the sll package in order to allow reuse of this method, without changing the public interface and client visible behaviour for either the SLL or SLLNode classes? And the sll package is not allowed to refer to the dll package or its contents in any way, and must not implement a doubly linked list itself.

The following Java class, represents a singly linked list:



And the following subclass represents a doubly linked list:



Would be thankful for any kind of help!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!