'MyClass' use of class template requires template argument list
My template class is as follows:
template <class T=int> class MyClass{
:
:
}
Another class has this template class as members.
#include "MyClass.h"
class B{
private:
MyClass a; //This line gives me the above mentioned error
:
public:
B(MyClass in): a(in) {}
}
what am i doing wrong?
I wanted to do something like this:
MyClass<T> a;
where the type of a i.e. the member would be defined by what's passed in to the constructor. Is this possible?
Can the type of a member be a template class, whose type parameter (T=int or float etc) be defined at compile time by what's passed in the constructor?