diff options
| -rw-r--r-- | InclassExercise14/Contact.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/InclassExercise14/Contact.cpp b/InclassExercise14/Contact.cpp index fadde86..13f1183 100644 --- a/InclassExercise14/Contact.cpp +++ b/InclassExercise14/Contact.cpp @@ -9,6 +9,31 @@ class Contact { int zip{}; char* _email{}; +public: + + Contact(const Contact& other) { + firstName = new + char[strlen(other._firstName) + 1] + + _lastName = new + char[strlen(other._lastName) + 1]; + } + + contact& operator =(const Contact& other) { + if (this != &other) { + delete[] _firstName; + delete[]_lastName; + } + + return 0; + } + + Contact(Contact&& other) { + _firstName = other._firstName; + _lastName = other._lastName; + + other._firstName = nullptr; + other._lastName = nullptr; Contact() = default; Contact() { |