Hey, I am having trouble coming up with a way to simplify the arithmetic equations that I am creating using classes. The purpose of my program is to manipulate mathematical equations. It is built using hierarchies, and has separate classes for math operators (addition, multiplication, subtraction, and multiplication, and it also does negation), and also a class for numbers, and a class for variables. it's built so that to add two things together you declare a few variables(C++ variables) as numbers or math variables, and then you can do the operations on them, such as
Code:
add_together(variable1, variable2);
where variables could be a variable such as X (with or without an associated value), and numbers (0,1,2,3, ... ). I cannot figure out what approach i should take to implement a simply class using the visitor.