Hi I'm a beginer studying C++, I'm learning templates and saw some code like this :
template <class T>
class MyClass
{
typename T::SubType m_var;
};
I was wondering what's the difference between that and this code :
template <class T>
class MyClass
{
T m_var;
};
why did they use the keyword "typename" if I can just declare my attribute without it? and if my class attribute's name is "m_var" what's the point of "T::SubType"? is that another way to call the attribute ?
I tried to instantiate an object from class MyClass and got this error :
error: βintβ is not a class, struct, or union type