diff options
| author | Miles-Cell <[email protected]> | 2024-03-21 13:00:06 -0700 |
|---|---|---|
| committer | Miles-Cell <[email protected]> | 2024-03-21 13:00:06 -0700 |
| commit | d8e6bc03aa2d7f3d10af6bbe27049cdd37414dff (patch) | |
| tree | 1c284f570696448d30dc3fb1a64d4f0d5f3afa47 /In Class Exercise 14/Contact.h | |
| parent | Excercise completed!! (diff) | |
| download | in-class-exercise-14-miles-cell-develop.tar.xz in-class-exercise-14-miles-cell-develop.zip | |
Staged and pushingdevelop
Diffstat (limited to 'In Class Exercise 14/Contact.h')
| -rw-r--r-- | In Class Exercise 14/Contact.h | 179 |
1 files changed, 0 insertions, 179 deletions
diff --git a/In Class Exercise 14/Contact.h b/In Class Exercise 14/Contact.h deleted file mode 100644 index 400f7fb..0000000 --- a/In Class Exercise 14/Contact.h +++ /dev/null @@ -1,179 +0,0 @@ -#ifndef CONTACT_H -#define CONTACT_H - -#include <iostream> - - -#include <iostream> -#include <string> -#include <cstring> -#include <cstdlib> - - - -class Contact { -private: - char* _firstName{}; - char* _lastName{}; - char* _streetAddress{}; - char* _city{}; - char* _state{}; - int zip; - char* _email{}; - - - Contact(const Contact& other); - - Contact& operator=(const Contact& other); - - Contact(Contact&& other) noexcept; - - Contact& operator=(Contact&& other) noexcept; - -public: - Contact() {} - - ~Contact() {} - - void setFirstName(char* firstName) { - _firstName = firstName; - } - - char* getFirstName() const { - return _firstName; - } - - void setLastName(char* lastName) { - _lastName = lastName; - } - - char* getLastName() const { - return _lastName; - } - - void setStreetAddress(char* streetAddress) { - _streetAddress = streetAddress; - } - - char* getStreetAddress() const { - return _streetAddress; - } - - void setCity(char* city) { - _city = city; - } - - char* getCity() const { - return _city; - } - - void setState(char* state) { - _state = state; - } - - char* getState() const { - return _state; - } - - void setZip(int zipCode) { - zip = zipCode; - } - - int getZip() const { - return zip; - } - - void setEmail(char* email) { - _email = email; - } - - char* getEmail() const { - return _email; - } - - void Print() const { - std::cout << "First Name: " << _firstName << std::endl; - std::cout << "Last Name: " << _lastName << std::endl; - std::cout << "Street Address: " << _streetAddress << std::endl; - std::cout << "City: " << _city << std::endl; - std::cout << "State: " << _state << std::endl; - std::cout << "Zip: " << zip << std::endl; - std::cout << "Email: " << _email << std::endl; - } -}; - - -Contact::Contact(const Contact& other) -{ - _firstName = (other._firstName); - _lastName = (other._lastName); - _streetAddress = (other._streetAddress); - _city = (other._city); - _state = (other._state); - _email = (other._email); - zip = other.zip; - -} - -Contact& Contact::operator=(const Contact& other) -{ - if (this != &other) { - free(_firstName); - free(_lastName); - free(_streetAddress); - free(_city); - free(_state); - free(_email); - _firstName = (other._firstName); - _lastName = (other._lastName); - _streetAddress = (other._streetAddress); - _city = (other._city); - _state = (other._state); - _email = (other._email); - zip = other.zip; - } - return *this; -} - -Contact::Contact(Contact&& other) noexcept - : _firstName(other._firstName), _lastName(other._lastName), _streetAddress(other._streetAddress), _city(other._city), _state(other._state), zip(other.zip), _email(other._email) -{ - other._firstName = nullptr; - other._lastName = nullptr; - other._streetAddress = nullptr; - other._city = nullptr; - other._state = nullptr; - other._email = nullptr; -} - -Contact& Contact::operator=(Contact&& other) noexcept -{ - if (this != &other) - { - free(_firstName); - free(_lastName); - free(_streetAddress); - free(_city); - free(_state); - free(_email); - _firstName = other._firstName; - _lastName = other._lastName; - _streetAddress = other._streetAddress; - _city = other._city; - _state = other._state; - _email = other._email; - zip = other.zip; - other._firstName = nullptr; - other._lastName = nullptr; - other._streetAddress = nullptr; - other._city = nullptr; - other._state = nullptr; - other._email = nullptr; - } - return *this; -} - - - - -#endif !CONTACT_H
\ No newline at end of file |