Rename directories, fix assignment operator in singlelist
This commit is contained in:
parent
255ba5a291
commit
110ac83be8
|
@ -19,7 +19,7 @@ int main()
|
|||
{
|
||||
std::cout << "Driver: \n";
|
||||
|
||||
SingleList testList;
|
||||
SingleList testList, test;
|
||||
bool exit = false;
|
||||
int choice = -1;
|
||||
int val, key;
|
||||
|
@ -41,6 +41,7 @@ int main()
|
|||
std::cin >> val;
|
||||
std::cin.clear();
|
||||
testList.insert(val);
|
||||
test = testList;
|
||||
break;
|
||||
|
||||
case INSERTAT:
|
||||
|
@ -67,6 +68,7 @@ int main()
|
|||
|
||||
case PRINT:
|
||||
testList.print();
|
||||
test.print();
|
||||
break;
|
||||
|
||||
case FIND:
|
|
@ -42,11 +42,10 @@ SingleList::SingleList(const SingleList& rhs)
|
|||
* @param rhs SingleList object
|
||||
* @return SingleList& A shallow copy of the rhs SingleList in the assignment
|
||||
*/
|
||||
SingleList SingleList::operator=(SingleList& rhs)
|
||||
SingleList SingleList::operator=(SingleList rhs)
|
||||
{
|
||||
if (this == &rhs) return *this;
|
||||
else head = rhs.head;
|
||||
|
||||
std::swap(head, rhs.head);
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@ class SingleList{
|
|||
public:
|
||||
SingleList() : head(NULL) {};
|
||||
SingleList(const SingleList& rhs);
|
||||
SingleList operator=(SingleList& rhs);
|
||||
SingleList operator=(SingleList rhs);
|
||||
~SingleList();
|
||||
bool insert(int val);
|
||||
bool insert(int val, int key);
|
Loading…
Reference in New Issue