Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void List::operator+=(int key)
- {
- this->addToEnd(key);
- }
- void List::operator+=(ListElement& element)
- {
- this->addToEnd(ListElement * element);
- }
- void List::operator+=(ListElement* element)
- {
- this->addToEnd(ListElement *element);
- }
- void List::operator-=(int key)
- {
- this->removeKey(key);
- }
- void List::operator-=(ListElement& element)
- {
- this->removeKey(element->getKey());
- }
- void List::operator-=(ListElement* element)
- {
- this->removeKey(element->getKey());
- }
- bool List::operator== (List& otherList)
- {
- bool control;
- if (sizeof(this) == sizeof(otherList))
- {
- while (this->next != NULL)
- {
- control = 0;
- while (otherList->next != NULL)
- {
- if (this->getKey() == otherList->getKey())
- {
- control = 1;
- }
- otherList = otherList->next;
- }
- if (!control)
- {
- return 0;
- }
- this = this->next;
- }
- return 1;
- }
- else
- {
- return 0;
- }
- }
- bool List::operator!= (List& otherList)
- {
- bool control;
- if (sizeof(this) != sizeof(otherList))
- {
- while (this->next != NULL)
- {
- control = 1;
- while (otherList->next != NULL)
- {
- if (this->getKey() == otherList->getKey())
- {
- control = 0;
- }
- otherList = otherList->next;
- }
- if (!control)
- {
- return 0;
- }
- this = this->next;
- }
- return 1;
- }
- else
- {
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement