Say my BasicLinkedList(BLL) has these following basic methods:
-insert at the head, tail, anywhere
-delete at the head, tail, anywhere
I want to know if I should use composition or inheritance to create my DLL from BLL.
My thought process:
My guess was composition from the read up of Effective Java Item #18(3rd Edition): Favour composition over inheritance.
But composition didn't feel right here as I didn't know how to incorporate the pointer to previous node with delegation.
Then I read up on Liskov substitution Principle(LSP) and seems that inheritance is the right choice? But I'm not sure.
Question(summarised): Should I use composition or inheritance to create my DLL from BLL? Why?