TwoDimensionalFigure
is a sub class of Figure
and the base class of RectangleFigure
and EllipseFigure
. A two-dimensional figure can be filled or unfilled. TwoDimensionalFigure
has the field m_bFilled
with their methods Fill
and IsFilled
to keep track of the fill status.
class TwoDimensionalFigure : public Figure { public: TwoDimensionalFigure(); TwoDimensionalFigure(const Color& color, BOOL bFilled); BOOL IsFilled() const {return m_bFilled;} void Fill(const BOOL bFill) {m_bFilled = bFill;} void Serialize(CArchive& archive); private: BOOL m_bFilled; };
The implementation of Figure
is rather straightforward. Remember that each time we introduce a new class to the application we have to include the header file StdAfx.h
at the beginning of the implementation file. Otherwise, the application will not work.