hi i am develop a class that manage multiples data types, by so i have created a class wrapper that can contain a diverse types of data, but a im stuck with a compiler issue:
class BaseType{
public:
virtual ~BaseType(){}
virtual BaseType & clone() const =0;
};
template<typename T>
class DataType : public BaseType
{
public:
DataType(const T & aValueData = T()):mValue(aValueData) {}
BaseType & clone() const
{
return DataType<T>();
}
private:
T mValue;
};
class MValueData
{
public:
template<typename T>
MValueData(T & aAnyValue = DataType(aAnyValue)):mTypeData(aAnyValue)
{}
private:
BaseType mTypeData;
};
int main()
{
return 0;
}
This code generate the following compiler error:
error: cannot declare field 'MValueData::mTypeData' to be of abstract type 'BaseType'
the mTypeData menber variable is declared as it, but it is derived from basetype, i dont see the error. Thx in advance