template<int max_number> class Test {
private:
// static object definition
static Test Global;
public:
// constructor
Test(int x){
int y;
y = x;
}
//static object definition inside template
Test::Global(5);
};
Test :: Global(5)上有错误;如何在模板中声明类对象实例?签名应该是什么?
答案 0 :(得分:0)
template < int max >
struct Test { static Test global; };
template < int max >
Test<max>::global(5);