diff --git a/container/SinglyLinkedList.h b/container/SinglyLinkedList.h index ed466086..7fffdaac 100644 --- a/container/SinglyLinkedList.h +++ b/container/SinglyLinkedList.h @@ -61,8 +61,8 @@ public: this->next = next; } - void setEnd() { - this->next = nullptr; + virtual void setEnd() { + this->next = nullptr; } LinkedElement* begin() { @@ -107,6 +107,11 @@ public: void setStart(LinkedElement* setStart) { start = setStart; } + + void setEnd(LinkedElement* setEnd) { + setEnd->setEnd(); + } + protected: LinkedElement *start = nullptr; };