diff options
Diffstat (limited to 'Extercise project/Extercise project/contact.cpp')
| -rw-r--r-- | Extercise project/Extercise project/contact.cpp | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/Extercise project/Extercise project/contact.cpp b/Extercise project/Extercise project/contact.cpp index 83298ca..7852de9 100644 --- a/Extercise project/Extercise project/contact.cpp +++ b/Extercise project/Extercise project/contact.cpp @@ -1,8 +1,54 @@ #include "contact.h" #include <iostream> +#include <array> Contact::Contact() { } +/* +Contact::Contact(const char* firstname, const short age) { + _firstname = firstname; + _age = age; +} +*/ +Contact::Contact(const Contact& copy) { + *this = copy; +} + +Contact& Contact::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; +} + +Contact Contact::anothercont() +{ + + return Contact(); +} +//_age = rhs._age; + +Contact& Contact:: operator=(Contact&& rhs) { + if (this != &rhs) { + _firstname = rhs._firstname; + _lastname = rhs._lastname; + } + return *this; +} + +Contact::Contact(Contact&& move) { + *this = move; +} + +/* void Contact::SetAge(short age) { _age = age; } @@ -10,7 +56,7 @@ Contact::Contact() { } short Contact::GetAge() { return _age; } - + */ const char* Contact::Getfirstname() { return _firstname; } @@ -74,7 +120,7 @@ const char* Contact::GetEmail() { void Contact::Print() { std::cout << "First Name: " << _firstname << std::endl; std::cout << "Last Name: " << _lastname << std::endl; - std::cout << "Age: " << _age << std::endl; + //std::cout << "Age: " << _age << std::endl; std::cout << "StreetAddress: " << _Streetaddress << std::endl; std::cout << "City: " << _city << std::endl; std::cout << "State: " << _state << std::endl; |