diff options
Added work from todays practice
1 files changed, 14 insertions, 0 deletions
| -rw-r--r-- | Year 1/Object-oriented Programming/09-Practice-19.04.2022/Product.cpp | 14 |
diff --git a/Year 1/Object-oriented Programming/09-Practice-19.04.2022/Product.cpp b/Year 1/Object-oriented Programming/09-Practice-19.04.2022/Product.cpp new file mode 100644 index 0000000..209ad74 --- /dev/null +++ b/Year 1/Object-oriented Programming/09-Practice-19.04.2022/Product.cpp @@ -0,0 +1,14 @@ +#include "Product.h" +#include <cstring> + +Product::Product() : Product("") +{} + +Product::Product(const char* name) { + this->name = new char[strlen(name) + 1]; + strcpy(this->name, name); +} + +Product::~Product() { + delete[] this->name; +} |
