diff options
| author | Yana Blashchishina <[email protected]> | 2024-03-07 17:41:26 -0800 |
|---|---|---|
| committer | Yana Blashchishina <[email protected]> | 2024-03-07 17:41:26 -0800 |
| commit | bbdf772656c277a78b245e89ad295519cc7d5e18 (patch) | |
| tree | bf7883bb37a0b9ad9e88ac9d9ac2c1847e5b3284 | |
| parent | contacts.hpp added (diff) | |
| download | archived-homework-8-yanablash-bbdf772656c277a78b245e89ad295519cc7d5e18.tar.xz archived-homework-8-yanablash-bbdf772656c277a78b245e89ad295519cc7d5e18.zip | |
errors :(
| -rw-r--r-- | Homework 8/Homework 8/main.cpp | 8 | ||||
| -rw-r--r-- | Homework 8/MyStructures/Contact.hpp | 105 |
2 files changed, 113 insertions, 0 deletions
diff --git a/Homework 8/Homework 8/main.cpp b/Homework 8/Homework 8/main.cpp index 6da2601..823dbec 100644 --- a/Homework 8/Homework 8/main.cpp +++ b/Homework 8/Homework 8/main.cpp @@ -3,6 +3,7 @@ // Class:CST116 // Assignment: Homework 8 +#include <iostream> #include "Contact.hpp" @@ -10,8 +11,15 @@ using namespace MyStructures; int main() { + Contact<char> newContact; + Contact<int> intContact; + char y = 'y'; + + newContact.SetCustomValue(y); + + std::cout << newContact.GetCustomValue(); return 0; }
\ No newline at end of file diff --git a/Homework 8/MyStructures/Contact.hpp b/Homework 8/MyStructures/Contact.hpp index 44cc0ed..5d47aed 100644 --- a/Homework 8/MyStructures/Contact.hpp +++ b/Homework 8/MyStructures/Contact.hpp @@ -3,10 +3,115 @@ namespace MyStructures { + template<typename T> + class Contact + { + public: + Contact() = default; + Contact(const char* name, short age); + + ~Contact() = default; + + Contact(const Contact& copy); + Contact& operator=(const Contact& rhs); + + Contact(Contact&& move); + Contact& operator=(Contact&& rhs); + + short GetAge(); + const char* GetName(); + + void SetAge(short age); + void SetName(const char* name); + + T GetCustomValue(); + void SetCustomValue(T& newValue); + + void Print(); + + private: + const char* name_{}; + short age_{ 0 }; + T custom_value_{}; + + + + + }; + +} + +template <typename T> +Contact<T>::Contact(const char* name, short age) +{ +} + +template <typename T> +Contact<T>::Contact(const Contact& copy) +{ +} + +template <typename T> +Contact<T>& Contact<T>::operator=(const Contact& rhs) +{ +} + +template <typename T> +Contact<T>::Contact(Contact&& move) +{ +} + +template <typename T> +Contact<T>& Contact<T>::operator=(Contact&& rhs) +{ + +} + +template <typename T> +short Contact<T>::GetAge() +{ + +} + +template <typename T> +const char* Contact<T>::GetName() +{ } +template <typename T> +void Contact<T>::SetAge(short age) +{ + +} + + +template<typename T> +void Contact<T>::SetName(const char* name) +{ + +} + + +template<typename T> +T Contact<T>::GetCustomValue() +{ + return custome_value_; +} + + +template<typename T> +void Contact<T>::SetCustomValue(T& newValue) +{ + custom_value_ = newValue; +} + + +template<typename T> +void Contact<T>::Print() + { + } #endif
\ No newline at end of file |