diff options
| author | Connor McDowell <[email protected]> | 2024-03-08 14:59:54 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-03-08 14:59:54 -0800 |
| commit | 1ecae6c20760afe02584600d8494bfb719d9ea3b (patch) | |
| tree | 2fb19f26209706ef2f9cef8b20c63023c93e5b1e | |
| parent | Contact class gets, sets, and print initialized (diff) | |
| download | homework-8-connormcdowell275-1ecae6c20760afe02584600d8494bfb719d9ea3b.tar.xz homework-8-connormcdowell275-1ecae6c20760afe02584600d8494bfb719d9ea3b.zip | |
copy and move constructs and operators filled
| -rw-r--r-- | My structures/Contact.hpp | 28 | ||||
| -rw-r--r-- | Project1/main.cpp | 3 |
2 files changed, 25 insertions, 6 deletions
diff --git a/My structures/Contact.hpp b/My structures/Contact.hpp index f13ace6..17f20c1 100644 --- a/My structures/Contact.hpp +++ b/My structures/Contact.hpp @@ -74,25 +74,45 @@ namespace myStructures template <class C> contact<C>::contact(const contact& copy) { - + *this = copy; } template <class C> contact<C>& contact<C>::operator=(const 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; } template <class C> contact<C>::contact(contact&& move) { - + *this = move; } template <class C> contact<C>& contact<C>::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; } // getter and setter defs for CLASS CONTACT diff --git a/Project1/main.cpp b/Project1/main.cpp index 14f761b..e4e969a 100644 --- a/Project1/main.cpp +++ b/Project1/main.cpp @@ -13,8 +13,7 @@ using namespace myStructures; int main() { - contact<char> newContact; - contact<int> intContact; + return 0; } |