The default constructor of Figure
is used only in connection with serialization. The second constructor is called by the sub classes in order to initialize the figure's color and mark status. The third constructer is called by the Copy
function, which in turn is called by the document class when the user wants to copy or paste a figure. It returns a pointer to a copy of the figure object. It is defined in each sub class in such a way that Copy
calls the copy
constructor. The copy
constructor itself would not be sufficient because we want to copy a figure given only a pointer to a Figure
object; that is, without knowing the class of the object.
All figures have two things in common: they have a color, and they may be marked. The class has two fields m_bMarked
and m_figureColor
reflecting these features. It also has the functions IsMarked
, Mark
, SetColor
, and GetColor
to inspect and modify the fields.
Serialize
is called by the framework when a user chooses to save or open...