diff --git a/plates/singlelist/driver.cpp b/plates/singlelist/driver.cpp index bcc4774..be746e1 100644 --- a/plates/singlelist/driver.cpp +++ b/plates/singlelist/driver.cpp @@ -19,7 +19,7 @@ int main() { std::cout << "Driver: \n"; - SingleList testList, test; + SingleList testList; bool exit = false; int choice = -1; int val, key; @@ -41,7 +41,6 @@ int main() std::cin >> val; std::cin.clear(); testList.insert(val); - test = testList; break; case INSERTAT: @@ -68,7 +67,6 @@ int main() case PRINT: testList.print(); - test.print(); break; case FIND: diff --git a/plates/singlelist/singlelist.cpp b/plates/singlelist/singlelist.cpp index 90308bb..ac2bf8f 100644 --- a/plates/singlelist/singlelist.cpp +++ b/plates/singlelist/singlelist.cpp @@ -36,11 +36,13 @@ SingleList::SingleList(const SingleList& rhs) } } -/** - * @brief Shallow copy of the rhs into the lhs of the assignemnt +/** operator= + * @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 - * @return SingleList& A shallow copy of the rhs SingleList in the assignment + * @param rhs SingleList object passed by value + * @return SingleList A deep copy of the rhs SingleList object */ SingleList SingleList::operator=(SingleList rhs) {