Hi all, I have the following problem:
I need to define the operator+() in the base class and the operator^(const derived &) in the derived class.
The code is as follow:
The compiler is saying that there is no operator^ that takes a base<double> (result of operator+) on the left and a derived on the right.
You could fix that by adding a derived-returning operator+ to the derived class, but this whole design seems strange: what kind of relationship do these classes have? Are you really planning polymorphic behavior based on run-time decisions?
If all you're trying to do is to give your base<double> a special member function that other base<T> don't have, then specialize: