0

I have the following code:

#include <iostream>
using namespace std;

template <class T> class kickingMyself {
public:
    static int a;
};

template <class T> kickingMyself<T>::a = 0;

int main() {
    kickingMyself<int>::a = 4;
    cout << kickingMyself<int>::a << endl;
    cin.get();
    return 0;
}

on the line:

template <class T> kickingMyself<T>::a = 0;

Im getting the following error:

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

I don't know why I'm getting this error. please help.

4

1 回答 1

1

您没有指定类型,应该是int

template <class T>
int kickingMyself<T>::a = 0;
于 2013-07-27T12:14:15.410 回答