From 183c356b4f87e0461af0f19284989edc9c8b8036 Mon Sep 17 00:00:00 2001 From: Angeld55 Date: Fri, 20 Sep 2019 14:57:31 +0300 Subject: Rename Big4AndInheritance/Drink.cpp to Big4AndInheritance/Drinks/Drink.cpp --- Big4AndInheritance/Drink.cpp | 63 -------------------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 Big4AndInheritance/Drink.cpp (limited to 'Big4AndInheritance/Drink.cpp') diff --git a/Big4AndInheritance/Drink.cpp b/Big4AndInheritance/Drink.cpp deleted file mode 100644 index 0e5bc77..0000000 --- a/Big4AndInheritance/Drink.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include "Drink.h" - - -void Drink::CopyFrom(const Drink& other) -{ - int len = strlen(other.mark); - mark = new char[len + 1]; - strcpy(mark, other.mark); - - ml = other.ml; -} -void Drink::Free() -{ - delete[] mark; - ml = 0; -} - -Drink::Drink() -{ - mark = new char[6]; - strcpy(mark, "Water"); - ml = 500; -} -Drink::Drink(const char* mark, int ml) -{ - int len = strlen(mark); - this->mark = new char[len + 1]; - strcpy(this->mark, mark); - - setML(ml); - -} -Drink::Drink(const Drink& other) -{ - CopyFrom(other); -} -Drink& Drink::operator=(const Drink& other) -{ - if (this != &other) - { - Free(); - CopyFrom(other); - } - return *this; -} -Drink::~Drink() -{ - Free(); -} -void Drink::setML(int ml) -{ - if (ml < 100 || ml> 1000) - ml = 500; - this->ml = ml; -} -int Drink::getML() const -{ - return ml; -} -const char* Drink::getMark() const -{ - return mark; -} \ No newline at end of file -- cgit v1.3.1-23-gd82d