-3
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);

    };

There is error on Test::Global(5); How can I declare class object instance in template? What signature should be?

1 Answers1

0
template < int max >
struct Test { static Test global; };

template < int max >
Test<max>::global(5);
Edward Strange
  • 40,307
  • 7
  • 73
  • 125