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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
#ifndef CONTACT_HPP
#define CONTACT_HPP
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
using namespace std;
namespace myStructures
{
template <class C>
class contact
{
public:
// constructors and destructors.
contact() = default;
contact(size_t a, string firstName, string lastName, string streetAddress, string city, string state, int zip, string email);
~contact() = default;
contact(const contact& copy); // copy constructor
contact& operator=(const contact& rhs); // copy assignment
contact(contact&& move) noexcept; // move constructor
contact& operator=(contact&& rhs) noexcept; // move assignment
//getters and setters
string Get_firstName();
void Set_firstName(string firstName);
string Get_lastName();
void Set_lastName(string lastName);
string Get_streetAddress();
void Set_streetAddress(string streetAddress);
string Get_city();
void Set_city(string city);
string Get_state();
void Set_state(string state);
int Get_zip();
void Set_zip(int zip);
string Get_email();
void Set_email(string email);
size_t Get_a();
void Set_a(size_t a);
size_t Get_id();
void Set_id(size_t id);
void print();
private:
size_t _a = 0;
// _a functions as delete bool. if a = 1, the slot is overwritten
/*int _id;*/
string _firstName;
string _lastName;
string _streetAddress;
string _city;
string _state;
int _zip;
string _email;
C custom_value{};
};
// constructor defs for CLASS CONTACT
template <class C>
contact<C>::contact(size_t a, string firstName, string lastName, string streetAddress, string city, string state,
int zip, string email)
{
}
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) noexcept
{
*this = move;
}
template <class C>
contact<C>& contact<C>::operator=(contact&& rhs) noexcept
{
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
template <class C>
string contact<C>::Get_firstName()
{
return _firstName;
}
template <class C>
void contact<C>::Set_firstName(string firstName)
{
_firstName = firstName;
}
template <class C>
string contact<C>::Get_lastName()
{
return _lastName;
}
template <class C>
void contact<C>::Set_lastName(string lastName)
{
_lastName = lastName;
}
template <class C>
string contact<C>::Get_streetAddress()
{
return _streetAddress;
}
template <class C>
void contact<C>::Set_streetAddress(string streetAddress)
{
_streetAddress = streetAddress;
}
template <class C>
string contact<C>::Get_city()
{
return _city;
}
template <class C>
void contact<C>::Set_city(string city)
{
_city = city;
}
template <class C>
string contact<C>::Get_state()
{
return _state;
}
template <class C>
void contact<C>::Set_state(string state)
{
_state = state;
}
template <class C>
int contact<C>::Get_zip()
{
return _zip;
}
template <class C>
void contact<C>::Set_zip(int zip)
{
_zip = zip;
}
template <class C>
string contact<C>::Get_email()
{
return _email;
}
template <class C>
void contact<C>::Set_email(string email)
{
_email = email;
}
template <class C>
size_t contact<C>::Get_a()
{
return _a;
}
template <class C>
void contact<C>::Set_a(size_t a)
{
_a = a;
}
template <class C>
void contact<C>::print()
{
//cout << "Contact number: " << _id << endl;
cout << "Full name: " << _firstName << " " << _lastName << endl;
cout << "Email: " << _email << endl;
cout << "Street Address: " << _streetAddress << endl;
cout << "City: " << _city << endl;
cout << "State: " << _state << endl;
cout << "Zip code: " << _zip << endl;
}
}
#endif CONTACT_HPP
|