Selamün Aleyküm;
Şöyle bir kodum var:
class Example
{
public:
template<typename T>
static void callMethod(const T val);
};
template<>
void Example::callMethod<int>(const int val)
{
cout << "Integer = " << val << endl;
}
template<>
void Example::callMethod<float>(const float val)
{
cout << "Float = " << val << endl;
}
template<>
void Example::callMethod<char*>(const char* val)
{
cout << "Char* = " << val << endl;
}
int main()
{
Example::callMethod<int>(17);
Example::callMethod<float>(3.8);
Example::callMethod<char*>("Hello");
return 0;
}
Bu kodu çalıştırdığımda şöyle bir hata alıyorum:
'template-id ‘callMethod<char>’ for ‘void Example::callMethod(const char)’ does not match any template declaration**'
Bunun tam olarak sebebi nedir? Teşekkürler.
--
[ Bu gönderi, http://ddili.org/forum'dan dönüştürülmüştür. ]
Permalink
Reply