テンプレートの外部でメンバー関数を宣言しようとしています - GetValue。
エラーが発生しています: main.cpp|16|エラー: 'GenericType Test::GetValue()'| の再定義| |エラー: 'GenericType Test::GetValue()' は以前ここで宣言されました|
#include <iostream>
template <class GenericType>
class Test {
public:
GenericType x;
Test(){ }
Test(int y) : x( y){ }
GenericType GetValue(){}
};
template <class GenericType>
GenericType Test<GenericType>::GetValue(){
return x;
}
int main()
{
Test<int> y(5);
std::cout << y.GetValue();
return 0;
}