Wednesday, 21 August 2013

Making an object of template class

Making an object of template class

I have a template class defined :
template <class T>
class TempClass
{
...
};
If I want to make an object of this class in let's say some MyClass.h to
access functions of template class, how shall I pass the argument of the
template? I tried to do the following:
class MyClass{
public:
TempClass<T> temp;
}
Sure, as supposed it does not work, as T is not defined in MyClass, so I
am a bit lost how do it correctly.
Thanks.

No comments:

Post a Comment