diff options
| author | Connor McDowell <[email protected]> | 2024-02-22 19:03:13 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-02-22 19:03:13 -0800 |
| commit | 71af5a377a536bcd08036e5cb4631c78370802a2 (patch) | |
| tree | 713d91ee96614026ba37f52b19ae275f08f9cd64 | |
| parent | working with moves (diff) | |
| download | in-class-exercise-14-connormcdowell275-main.tar.xz in-class-exercise-14-connormcdowell275-main.zip | |
| -rw-r--r-- | Project1/contact.cpp | 15 | ||||
| -rw-r--r-- | Project1/contact.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/Project1/contact.cpp b/Project1/contact.cpp index e4ba37e..95c26f6 100644 --- a/Project1/contact.cpp +++ b/Project1/contact.cpp @@ -31,6 +31,21 @@ contact::contact(contact&& move) //also *this = std::move(move); } +contact& contact::operator=(contact&& rhs) +{ + if (this != &rhs) + { + _firstName = rhs._firstName; + _lastName = rhs._lastName; + _streetAddress = rhs._streetAddress; + _city = rhs._city; + _state = rhs._state; + _zip = rhs._zip; + _email = rhs._email; + } + return *this; +} + void contact::Set_firstName(const char* firstName) { diff --git a/Project1/contact.h b/Project1/contact.h index 65d1b6f..90791b7 100644 --- a/Project1/contact.h +++ b/Project1/contact.h @@ -19,6 +19,7 @@ public: contact& operator=(const contact& rhs); contact(contact&& move); + contact& operator=(contact&& rhs); const char* Get_firstName(); void Set_firstName(const char* firstName); |