aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor McDowell <[email protected]>2024-03-08 14:36:01 -0800
committerConnor McDowell <[email protected]>2024-03-08 14:36:01 -0800
commitdba2170b1e297b4108500d0dca38b1b53283e18a (patch)
tree00f45b669c01a2a66d99849d15a5ff919daa8841
parentlinked with namespace (diff)
downloadhomework-8-connormcdowell275-dba2170b1e297b4108500d0dca38b1b53283e18a.tar.xz
homework-8-connormcdowell275-dba2170b1e297b4108500d0dca38b1b53283e18a.zip
contact list class copied in
writing contact class
-rw-r--r--My structures/Contact.hpp88
1 files changed, 88 insertions, 0 deletions
diff --git a/My structures/Contact.hpp b/My structures/Contact.hpp
index 5a53fea..0877b1a 100644
--- a/My structures/Contact.hpp
+++ b/My structures/Contact.hpp
@@ -1,12 +1,100 @@
#ifndef CONTACT_HPP
#define CONTACT_HPP
+#include <iostream>
+using namespace std;
+
namespace myStructures
{
+ template <class C>
+ class contact
+ {
+ public:
+ // constructors and destructors.
+ contact() = default;
+
+ ~contact() = default;
+
+ contact(const contact& copy);
+ contact& operator=(const contact& rhs);
+
+
+ contact(contact&& move);
+ contact& operator=(contact&& rhs);
+
+
+ //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;
+
+ };
+
+
+
+
+
+
+ template <class CList>
+ class ContactList
+ {
+ public:
+ ContactList() = default;
+ ContactList(size_t size); //Creates contact list of this size
+ ContactList(const CList* contacts, const size_t& length); //Makes a copy of another contact list
+ ~ContactList();
+ ContactList(const ContactList& copy); //deep copy constructor
+ ContactList& operator=(const ContactList& rhs); //deep copy assignment
+ ContactList(ContactList&& move); //reference(move) constructor
+ ContactList& operator=(ContactList&& rhs); //reference(move) assignment
+ private:
+ CList* contacts_{ nullptr };
+ size_t length_{ 0 };
+ size_t size_{ 0 };
+ CList* AllocateContactList(const size_t& size);
+ };
}