I have the following code:

class date
{
private:
unsigned int nDay,nMonth,nYear;
static unsigned int nMonthArr[12] = {31,28,31,30,31,30,31,31,30,31,30,31}; //LINE 36
...

Upon compilation I recieve these errors:
n:\courses\8110\Labs\Lab7b\Lab7b.cpp(36) : error C2059: syntax error : '{'
n:\courses\8110\Labs\Lab7b\Lab7b.cpp(36) : error C2143: syntax error : missing ';' before '{'
n:\courses\8110\Labs\Lab7b\Lab7b.cpp(36) : error C2143: syntax error : missing ';' before '}'

I'm not sure what I am doing wrong here, I have only been working with c++ for a little while now and have searched everywhere to find nothing already posted on the web. Any help on this issue is greatly appreciated.

Denn0069

you can't initialize arrays like that in the class definitions. Initialize it in the *.cpp file just like you would any other global array.

// *.h file
class date
{
private:
unsigned int nDay,nMonth,nYear;
static unsigned int nMonthArr[12]; //LINE 36
...


// *.cpp file
unsigned int Date::nMonthArr[12] = {31,28,31,30,31,30,31,31,30,31,30,31}; //LINE 36

Thanks, :cheesy:
thought that with statics it was permissable though.

cheers,
denn0069