blob: 13f1183d668522f9ed6f0e3437bf8a54364dfd39 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include "Contact.h"
class Contact {
char* _firstName{};
char* _lastName{};
char* _streetAddress{};
char* _city{};
char* _state{};
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() {
delete[] _firstName;
delete[] _lastName;
delete[] _streetAddress;
delete[] _city;
delete[] _state;
delete[] _email;
}
|