I have a base class and a class derived from it. In the example below, Frame_Pic is a derived class of Base_Pic, the details of which I have not included. Frame_Pic has members, vertical,horizontal, and corners which is not in the base class. Picture is an interface class and basically holds a pointer to Base_Pic.
When I try to assign new values to these in the reframe function below, I get an error stating that Base_Pic has no such data members.
The action, pic.p->vertical, will think I am accessing the base class. If I put these data members in the base class, the rest of my functions are written in a way that it will not accommodate this addition. How can I assign to these data members?
Picture frame(const Picture& pic, char v, char c, char h)
{
Frame_Pic* temp = new Frame_Pic(pic.p);
temp->vertical = v;
temp->horizontal = h;
temp->corners = c;
Picture temp2(temp);
return temp2;
}
void reframe(Picture& pic, char v, char c, char h)
{
pic.p->vertical = v;
pic.p->horizontal = h;
pic.p->corners = c;
}