Hi, I'm sure that it is possible but I just can't do it, which is: How can I define function template inside non-template class? I tryied something like this:
class Stack_T
{
private:
void* _my_area;
static const int _num_of_objects = 10;
public:
/*
Allocates space for objects added to stack
*/
explicit Stack_T(size_t);
/*
Puts object onto stack
*/
template<class T>
void put(const T&);
/*
Gets last added object to the stack
*/
template<class T>
T& get()const;
/*
Removes last added object from the stack
*/
template<class T>
void remove(const T&);
virtual ~Stack_T(void);
};
template<class T> //SOMETHING WRONG WITH THIS DEFINITION
void Stack_T::put<T>(const T& obj)
{
}
but it doesn't work. I'm getting this err msg:
'Error 1 error C2768: 'Stack_T::put' : illegal use of explicit template arguments'
Thank you