template<int n>
struct Numberim{
enum{ value = Numberim<n-1>::value + n };
};
template<>
struct Numberim<0>{
enum{ value = 0 };
};
this is a simple tmp example,and it's ok;
template<int n>
class Numberim{
enum{ value = Numberim<n-1>::value + n };
};
template<>
class Numberim<0>{
enum{ value = 0 };
};
I use g++ to compile,and it complains...however, as far as I know, struct and class is treated nearly in the same way.just like this"In C++, the only difference between a struct and a class is that struct members are public by default, and class members are private by default."
So, what's the difference between them here in earth?