'Error C2614 'TypeInfo<double>': illegal member initialization: 'MyClass' is not a base or member [duplicate]
I need your help: I am getting the following error in C++:
Error C2614 'TypeInfo<double>': illegal member initialization: 'MyClass' is not a base or member
This is my Code:
template <class Data>
class MyClass {
protected:
Data data_type_1;
public:
MyClass()
: data_type_1(0)
{
}
MyClass(Data data_type_1)
: data_type_1(data_type_1)
{
}
void GetSize()
{
cout << "Data 1 : " << sizeof(data_type_1) << endl;
}
};
template <class Data>
class TypeInfo : public MyClass<Data> {
public:
TypeInfo(Data data_type)
: MyClass(data_type)
{
}
};
And I don't know that is happening here
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
