I am write a program that both uses inheritance and composition. I am a bit new to inheritance so I am a little confused on some aspects of it.
Let's say I have a class definition like this
class Month
{
Week *week[4];
}; // class Month
class Week
{
}; //class Week
class Day : public Week
{
} // class Day
I understand what it means if I create a Week object in week[0], but what if I create a Day object? Will week[0] be a Day object with Week characteristics? The classes in my program is composed of an array similar to this. Can I just do something like week[0] = new Day instead of week[0] = new Week to make it a Day object instead of what it was intended to be in my class definition?