I don't get it.....
Code:
template <class Dummy> class TTest
{
public:
template <typename C> void CallFunc(C *s, bool(C::*pMemberFunc)(void))
{
s->*pMemberFunc();
};
};
class CTest
{
public:
void bleh(void)
{
printf("Bleh\n");
};
};
int main()
{
TTest<short> *pTest = new TTest<short>;
CTest Test2;
pTest->CallFunc<CTest>(pTest, CTest::bleh);
return 0;
}
gives me the error
Quote:
error C2275: 'CTest' : illegal use of this type as an expression
E:\bot_tools\test_proggie\test3\test3\test3.cpp(44 2) : see declaration of 'CTest'
|
Acoording to my c++ book I should do this to call the function
Code:
pTest->template CallFunc<CTest>(pTest, CTest::bleh);
but then I get this error;
Quote:
error C2951: template declarations are only permitted at global or namespace scope
|
Can anyone help me