Node.cpp 497 B

1234567891011121314151617181920212223242526
  1. #include "List.h"
  2. // âñòðîåííûé îáúåêò m_Data äîëæåí ñòàòü êîïèåé îáúåêòà, íà êîòîðûé óêàçûâàåò pc
  3. Node::Node(Node* Prev, const Circle* pc) :m_Data(*pc)
  4. {
  5. pPrev = Prev;
  6. pNext = Prev->pNext;
  7. Prev->pNext = this;
  8. pNext->pPrev = this;
  9. }
  10. Node::~Node()
  11. {
  12. if (pPrev) { pPrev->pNext = /*this->*/pNext; }
  13. if (pNext) { pNext->pPrev = /*this->*/pPrev; }
  14. pPrev = pNext = nullptr;
  15. //delete[] this;
  16. }
  17. std::ostream& operator<<(std::ostream& os, const Node& node)
  18. {
  19. os << node.m_Data;
  20. return os;
  21. }