Add copy assignment, constructor, destructor

This commit is contained in:
Shaun Reed 2020-04-15 07:54:32 -04:00
parent b2e051a633
commit ba91c8956a
1 changed files with 4 additions and 1 deletions

View File

@ -11,7 +11,7 @@
*/ */
SingleList::SingleList(const SingleList& rhs) SingleList::SingleList(const SingleList& rhs)
{ {
head = rhs.head;
} }
/** /**
@ -22,6 +22,8 @@ SingleList::SingleList(const SingleList& rhs)
*/ */
SingleList& SingleList::operator=(const SingleList& rhs) SingleList& SingleList::operator=(const SingleList& rhs)
{ {
makeEmpty();
head = rhs.head;
return *this; return *this;
} }
@ -30,6 +32,7 @@ SingleList& SingleList::operator=(const SingleList& rhs)
*/ */
SingleList::~SingleList() SingleList::~SingleList()
{ {
makeEmpty();
} }
/****************************************************************************** /******************************************************************************