diff options
Add files via upload
1 files changed, 21 insertions, 0 deletions
| -rw-r--r-- | Polymorphism/MathExpression/Num.hpp | 21 |
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 |
