thats not a good example, you are wasting memory..
I would use something like this:
Code:
class Calendar{
public:
Month * table;
Calendar()
{
table =new Month[12]; //have a default const for Month
//initialize your private values
table[0]=Month("January", 31);
table[1]=Month("February", 28);
table[2]=Month("March", 31);
table[3]=Month("April", 30);
table[4]=Month("May", 31);
table[5]=Month("June", 30);
table[6]=Month("July", 31);
table[7]=Month("August", 31);
table[8]=Month("September", 30);
table[9]=Month("October", 31);
table[10]=Month("November", 30);
table[11]=Month("December", 31);
}
~Calendar()
{
delete [] table;
}
};