Website Summary Files Commits Branches @commit @diff @stats
path: root / Big4AndInheritance / Drinks
diff options
context:
space:
mode:
Commit112a0d344da9e66d20ee9ab5d488e59c5d52e6ad (patch)
Author
 Angeld55 <angel_dimitriev@abv.bg>
2020-04-09 18:09:42 +0300
Committer
 Angeld55 <angel_dimitriev@abv.bg>
2020-04-09 18:09:42 +0300
Filese3bb9cf17c24a3b53c746d9142906d550d549465 /Big4AndInheritance/Drinks
Object-oriented_programming_FMI-112a0d344da9e66d20ee9ab5d488e59c5d52e6ad.tar
Object-oriented_programming_FMI-112a0d344da9e66d20ee9ab5d488e59c5d52e6ad.tar.gz
Object-oriented_programming_FMI-112a0d344da9e66d20ee9ab5d488e59c5d52e6ad.zip
Parentec26fab32d144b436d08f9da6049bd053156d783 (diff)
added new examples
diff --git a/Big4AndInheritance/Drinks/AlcoholDrink.cpp b/Big4AndInheritance/Drinks/AlcoholDrink.cpp
deleted file mode 100644
index db3619c..0000000
--- a/Big4AndInheritance/Drinks/AlcoholDrink.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "AlcoholDrink.h"
-
-
-
-AlcoholDrink::AlcoholDrink(const char* mark, int ml, int percentAlcohol) : Drink(mark,ml)
-{
- setAlcohol(percentAlcohol);
-}
-void AlcoholDrink::setAlcohol(int alcohol)
-{
- if (alcohol < 4 || alcohol>98)
- alcohol = 20;
- percentAlcohol = alcohol;
-}
-int AlcoholDrink::getAlcohol() const
-{
- return percentAlcohol;
-}
diff --git a/Big4AndInheritance/Drinks/AlcoholDrink.h b/Big4AndInheritance/Drinks/AlcoholDrink.h
deleted file mode 100644
index 1bf3d66..0000000
--- a/Big4AndInheritance/Drinks/AlcoholDrink.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#pragma once
-
-#include "Drink.h"
-
-class AlcoholDrink : public Drink
-{
-private:
- int percentAlcohol;
-
-public:
- AlcoholDrink(const char* mark, int ml, int percentAlcohol);
- void setAlcohol(int alcohol);
- int AlcoholDrink::getAlcohol() const;
-};
diff --git a/Big4AndInheritance/Drinks/Drink.cpp b/Big4AndInheritance/Drinks/Drink.cpp
deleted file mode 100644
index a2933ad..0000000
--- a/Big4AndInheritance/Drinks/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;
-}
diff --git a/Big4AndInheritance/Drinks/Drink.h b/Big4AndInheritance/Drinks/Drink.h
deleted file mode 100644
index c02398b..0000000
--- a/Big4AndInheritance/Drinks/Drink.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#pragma once
-#include <iostream>
-
-class Drink
-{
-private:
- char* mark;
- int ml;
- void CopyFrom(const Drink& other);
- void Free();
-public:
- Drink();
- Drink(const char* mark, int ml);
- Drink(const Drink& other);
- Drink& operator=(const Drink& other);
- ~Drink();
-
- void setML(int ml);
- int getML() const;
- const char* getMark() const;
-};
diff --git a/Big4AndInheritance/Drinks/main.cpp b/Big4AndInheritance/Drinks/main.cpp
deleted file mode 100644
index 6c67b96..0000000
--- a/Big4AndInheritance/Drinks/main.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "AlcoholDrink.h"
-int main()
-{
- AlcoholDrink DR1("Spirt", 100, 98);
-
- AlcoholDrink dr2 (DR1);
- dr2.getMark();
-
-
-}