diff options
Diffstat (limited to 'Homework7/Homework7/ContactList.cpp')
| -rw-r--r-- | Homework7/Homework7/ContactList.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Homework7/Homework7/ContactList.cpp b/Homework7/Homework7/ContactList.cpp index b934182..df6c849 100644 --- a/Homework7/Homework7/ContactList.cpp +++ b/Homework7/Homework7/ContactList.cpp @@ -1,4 +1,5 @@ #include "ContactList.h" +#include <atomic> @@ -67,3 +68,39 @@ Contact* ContactList::AllocateContactList(const size_t& size) return contacts; } + + +ContactList::ContactList(const Contact& copy) { + *this = copy; +} + + +ContactList& ContactList::operator=(const ContactList& rhs) { + if (this != &rhs) { + contacts_ = rhs.contacts_; + length_ = rhs.length_; + size_ = rhs.size_; + rhs.contacts_ = nullptr; + rhs.length_ = 0; + rhs.size_ = 0; + + } + return *this; +} + + +ContactList::ContactList(Contact&& move) { + *this = std::move(move); +} + +ContactList& ContactList::operator=(ContactList&& rhs) { + if (this != &rhs) { + contacts_ = rhs.contacts_; + length_ = rhs.length_; + size_ = rhs.size_; + rhs.contacts_ = nullptr; + rhs.length_ = 0; + rhs.size_ = 0; + } + return *this; +}
\ No newline at end of file |