listassignop.cpp

来自「Data Abstraction & Problem Solving with 」· C++ 代码 · 共 18 行

CPP
18
字号
#include "List.h"// Assumes the following line added to List.h in public part// List & operator=(const List &rhs)// and existence of member functions removeAll and copyListNodes// void removeAll();// void copyListNodes(const List& aList);List & List::operator=(const List& rhs){   // check for assignment to self   if (this != &rhs)   {  removeAll();    // deallocate left-hand side      copyListNodes(rhs); // copy list nodes      size = rhs.size;    // copy size of list   }  // end if   return *this;} // end operator=

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?