I have class like below
template<class T>
class Student
{
public:
static Student& Instance();
}
template<class T>
Student<T>& Student<T>::Instance()
{
...
return student;
}
It returns LNK2001 error. Can I use this way?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your code is ambiguous, so I try to guess your problem. If you declared class Student in Student.h and implement method Instance() in Student.cpp, that is your problem. Implement method Instance() in Student.h.