singly linked list improvements

This commit is contained in:
Robin Müller 2020-06-17 20:37:45 +02:00
parent 259517ac9b
commit bb16fd80b8

View File

@ -61,8 +61,8 @@ public:
this->next = next; this->next = next;
} }
void setEnd() { virtual void setEnd() {
this->next = nullptr; this->next = nullptr;
} }
LinkedElement* begin() { LinkedElement* begin() {
@ -107,6 +107,11 @@ public:
void setStart(LinkedElement<T>* setStart) { void setStart(LinkedElement<T>* setStart) {
start = setStart; start = setStart;
} }
void setEnd(LinkedElement<T>* setEnd) {
setEnd->setEnd();
}
protected: protected:
LinkedElement<T> *start = nullptr; LinkedElement<T> *start = nullptr;
}; };