Hi
Does some of you know how to declare getCollection() in the cpp file?
My code snippet below produces following compile error:
foo.cpp(48) : error C2143: syntax error : missing ';' before '&'
foo.cpp(48) : error C2501: foo<T>::Collection' : missing storage-class
or type specifiers
foo.cpp(48) : error C2065: 'T' : undeclared identifier
foo.cpp(48) : error C2955: 'foo' : use of class template requires
template argument list
Hope you guys can help me...
foo.h
--------------------------------------
template <class T>
class foo
{
public:
typedef std::vector< foo<T> > Collection;
foo();
virtual ~foo(void);
Collection& getCollection();
private:
Collection col;
};
foo.cpp
--------------------------------------
template <class T>
foo<T>::foo(void)
{
}
template <class T>
foo<T>::~foo(void)
{
}
template <class T>
foo<T>::Collection& foo<T>::getCollection()
{
return col;
};