Code:
class Calendar
{
public:
int year;
int month;
Month *months;
Calendar()
{
Month table[] =
{
Month("January", 31),
Month("February", 28),
Month("March", 31),
Month("April", 30),
Month("May", 31),
Month("June", 30),
Month("July", 31),
Month("August", 31),
Month("September", 30),
Month("October", 31),
Month("November", 30),
Month("December", 31)
};
months = &table; //Line of error
}
~Calendar()
{
delete [] months;
}
}
c:\Documents and Settings\JoshuaT\My Documents\Visual Studio Projects\Calendar\Calendar.cpp(52): error C2440: '=' : cannot convert from 'Month (*__w64 )[12]' to 'Month *'
I wanted to try it this way, but for some reason I keep getting that error. Shouldn't it technically work?