i need to use the base constructor of formula in the constructor variable in order to set the value to unknown. i really dont know how to write that in c++
any help please? one more thing, did i use iheritance the way it is supposed to be used? in other words did i write the code right?
thank you guys
If Variable is to inherit from Formula you have to define it as a child class, which you have not done.
Then during the implementation of the constructor for Variable you can define which constructor to using from Formula using : formula(value)
e.g
1 2 3 4 5 6 7 8 9 10
class Base {
public:
explicit Base(int x) { };
explicit Base(string x) { };
}
class Child : public Base {
Child(int x, unsigned y) : Base(x) { } // Calls the int base constructor
Child() : Base("hello") { } // Calls the string base constructor
}