in C++, I need to write a composite pattern for representingthese expression trees, and I’m required to use thefollowing abstract base class which has been provided to me inbase.h:
class Base {
public:
/* Constructors */
Base() { };
/* Pure Virtual Functions */
virtual double evaluate() = 0;
virtual string stringify() = 0;
};
There are two main functions that you will need to develop forthis lab. The first function, evaluate(), will return the value ofa node while the second, stringify(), returns a stringrepresentation of the node. Remember that a node in this case couldrepresent a single value or an entire subtree.
You will need to develop the following classes
OR
OR