aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor McDowell <[email protected]>2024-02-22 18:47:36 -0800
committerConnor McDowell <[email protected]>2024-02-22 18:47:36 -0800
commit1f030ff2fb456846e1f56bd744cd3dd56fe1d476 (patch)
tree2f43707933a61f17af10aca722f545f0c989dcab
parentexcersize 13 files added (diff)
downloadin-class-exercise-14-connormcdowell275-1f030ff2fb456846e1f56bd744cd3dd56fe1d476.tar.xz
in-class-exercise-14-connormcdowell275-1f030ff2fb456846e1f56bd744cd3dd56fe1d476.zip
doing overload operator
-rw-r--r--Project1/contact.cpp13
-rw-r--r--Project1/contact.h11
-rw-r--r--Project1/main.cpp4
3 files changed, 27 insertions, 1 deletions
diff --git a/Project1/contact.cpp b/Project1/contact.cpp
index 884000d..0cfa0e3 100644
--- a/Project1/contact.cpp
+++ b/Project1/contact.cpp
@@ -5,6 +5,19 @@ using std::cin;
using std::cout;
using std::endl;
+contact::contact(const contact& copy)
+{
+ *this = copy;
+}
+
+contact& contact::operator=(const contact& rhs)
+{
+ if(this != &rhs)
+ {
+
+ }
+ return *this;
+}
void contact::Set_firstName(const char* firstName)
diff --git a/Project1/contact.h b/Project1/contact.h
index ced5d5f..58de6f6 100644
--- a/Project1/contact.h
+++ b/Project1/contact.h
@@ -1,10 +1,21 @@
#ifndef CONTACT_HELPER
#define CONTACT_HELPER
+
+// NOTE FOR ASSIGNMENT:
+// USE COMPLEX CONTACT()
+// contact(const char* name/address/etc etc)
+// with:
+// contact::contact(same as above){
+// _name = name
+// and so on for each item.
+// then when creating the list each input is automatically inserted into right spots.
class contact
{
public:
contact() = default;
+ contact(const contact& copy);
+ contact& operator=(const contact& rhs);
const char* Get_firstName();
void Set_firstName(const char* firstName);
diff --git a/Project1/main.cpp b/Project1/main.cpp
index 6d29960..cb0a77b 100644
--- a/Project1/main.cpp
+++ b/Project1/main.cpp
@@ -14,7 +14,7 @@ using std::endl;
int main()
{
contact newContact;
-
+
newContact.Set_firstName("Connor");
newContact.Set_lastName("McDowell");
newContact.Set_streetAddress("6051 Lakeview Blvd");
@@ -23,6 +23,8 @@ int main()
newContact.Set_zip(97035);
newContact.Set_email("[email protected]");
+ newContact = newContact;
+
newContact.print();
return 0;