Add comments for operator= in singlelist

This commit is contained in:
Shaun Reed 2020-04-26 22:19:34 -04:00
parent 110ac83be8
commit 23d1ce7b4a
2 changed files with 7 additions and 7 deletions

View File

@ -19,7 +19,7 @@ int main()
{ {
std::cout << "Driver: \n"; std::cout << "Driver: \n";
SingleList testList, test; SingleList testList;
bool exit = false; bool exit = false;
int choice = -1; int choice = -1;
int val, key; int val, key;
@ -41,7 +41,6 @@ int main()
std::cin >> val; std::cin >> val;
std::cin.clear(); std::cin.clear();
testList.insert(val); testList.insert(val);
test = testList;
break; break;
case INSERTAT: case INSERTAT:
@ -68,7 +67,6 @@ int main()
case PRINT: case PRINT:
testList.print(); testList.print();
test.print();
break; break;
case FIND: case FIND:

View File

@ -36,11 +36,13 @@ SingleList::SingleList(const SingleList& rhs)
} }
} }
/** /** operator=
* @brief Shallow copy of the rhs into the lhs of the assignemnt * @brief Assign two SingleList objects equal using copy constr and class destr
* Pass the rhs by value to create local copy, swap its contents
* Destructor called on previous SingleList data at the end of this scope
* *
* @param rhs SingleList object * @param rhs SingleList object passed by value
* @return SingleList& A shallow copy of the rhs SingleList in the assignment * @return SingleList A deep copy of the rhs SingleList object
*/ */
SingleList SingleList::operator=(SingleList rhs) SingleList SingleList::operator=(SingleList rhs)
{ {