blob: 8b2b1ee011a2901a5947998af3249b35cd6d0454 (
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
|
#ifndef CONTACT_LIST_H
#define CONTACT_LIST_H
#include "Contact.h"
class ContactList
{
public:
ContactList() = default;
ContactList(const size_t& size);
ContactList(const ContactList& copy); //CopyConstructor
ContactList& operator=(const ContactList& rhs); //CopyAssignment
ContactList(ContactList&& move); //MoveConstructor
ContactList& operator=(ContactList&& rhs); //MoveAssignment
~ContactList();
void DeleteContact(Contact& contact);
void CopyList(const Contact* contacts, const size_t& length); //constant reference because you dont want to change the value
void AddContact(const Contact& contact);
void PrintList() const; //const means that it will never change the data
size_t Size() const; //const function
private:
Contact* contacts_{ nullptr };
size_t length_{ 0 }; //total length of array
size_t size_{ 0 }; //total used elements in array
Contact* AllocateContactList(const size_t& size); //This is private because you don't want someone to have access to memory. No access outside of the class
};
#endif
|