Need help in template
-
Hi I am facing problem in accessing the function template written inside a class. My code is as follows. Please help me in this regard. mytemp.h class mytemp { public: mytemp(void); ~mytemp(void); template static T templateadd(T x, T y); }; mytemp.cpp template T mytemp::templateadd(T x, T y) { return (x + y); } main.cpp int _tmain(int argc, _TCHAR* argv[]) { cout<<mytemp::templateadd(10,2); // Here I am getting error: unresolved external symbol ... //Here I want to access templatedadd() of mytemp class. Please tell me What should be the statement. return 0; }
-
Hi I am facing problem in accessing the function template written inside a class. My code is as follows. Please help me in this regard. mytemp.h class mytemp { public: mytemp(void); ~mytemp(void); template static T templateadd(T x, T y); }; mytemp.cpp template T mytemp::templateadd(T x, T y) { return (x + y); } main.cpp int _tmain(int argc, _TCHAR* argv[]) { cout<<mytemp::templateadd(10,2); // Here I am getting error: unresolved external symbol ... //Here I want to access templatedadd() of mytemp class. Please tell me What should be the statement. return 0; }
-
Really helpfull. Thanks a lot Sashoalm.
-
Really helpfull. Thanks a lot Sashoalm.