Closed andreslopezlu closed 3 months ago
@andreslopezlu
Yeah, I agree; I think we should use this approach:
A Queue is a class not related to DoubleLinkedList; I mean it is not a child of DoubleLinkedList. Because the Queue won't expose or overwrite methods of the DoubleLinkedList, I think Queue must initiate a DoubleLinkedList in a private property and expose methods like add
and pop
, which will interact with the instance of DoubleLinkedList.
add
should add a new tail to the DoubleLinkedList.pop
should remove the head of the DoubleLinkedList and return the removed head value.what do you think?
Yes, that sounds great
@ImMPrada
According to the given approach, we want the Queue class to have an attribute of type DoubleLinkedList, which corresponds to a simple association between both classes. But before that, it had been defined that the Queue class could inherit from the DoubleLinkedList class. I think both approaches contradict each other, so we would have to define which is the most appropriate to implement in this application.