From 26cf424c42f9cdc172191faa5b2d1c1fcf350143 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 19 Apr 2022 21:04:23 +0300 Subject: Added work from todays practice --- .../09-Practice-19.04.2022/Product.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Year 1/Object-oriented Programming/09-Practice-19.04.2022/Product.cpp (limited to 'Year 1/Object-oriented Programming/09-Practice-19.04.2022/Product.cpp') 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 + +Product::Product() : Product("") +{} + +Product::Product(const char* name) { + this->name = new char[strlen(name) + 1]; + strcpy(this->name, name); +} + +Product::~Product() { + delete[] this->name; +} -- cgit v1.3.1-23-gd82d