From d2422da2c1b2fcf75a3212eb36e94a718a39c0a5 Mon Sep 17 00:00:00 2001 From: Angeld55 Date: Fri, 20 Sep 2019 16:02:36 +0300 Subject: Add files via upload --- Polymorphism/MathExpression/Num.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Polymorphism/MathExpression/Num.hpp (limited to 'Polymorphism/MathExpression/Num.hpp') diff --git a/Polymorphism/MathExpression/Num.hpp b/Polymorphism/MathExpression/Num.hpp new file mode 100644 index 0000000..d2da4ae --- /dev/null +++ b/Polymorphism/MathExpression/Num.hpp @@ -0,0 +1,21 @@ +#include "Expression.hpp" +class Num : public Expression +{ + int number; +public: + Num(int number) + { + this->number = number; + type = 1; + } + void Print() + { + std::cout << number; + } + int Evaluate() + { + return number; + } + + +}; \ No newline at end of file -- cgit v1.3.1-23-gd82d