Hello, I have the following problem. I have many functions that perform different operations, so I wanted to group this sharing with an interface (abstract class) of the Evaluable
typeNow as each function returns something different I thought I put something of the style.
+evaluar():void*
But it does not seem the most beautiful, so I implemented the following:
Evaluable.h
template <class T>
class Evaluable{
public:
Evaluable();
virtual ~Evaluable();
virtual T evaluar()=0;
};
Evaluable.c
template <typename T>
Evaluable<T>::Evaluable(){}
Therefore a derived class would be something of this style. Numb.h
class Number:public Evaluable<int>{
int numero;
public:
Number(std::string cadena);
~Number();
int evaluar();
};
But I miss the error:
Number.cpp:6: referencia a 'Evaluable<int>::Evaluable()' sin definir
Number.cpp:15: referencia a 'Evaluable<int>::~Evaluable()' sin definir
What I want is to have the possibility of having a list of Evaluables and call each one with evaluate ()