Showing posts with label forward declaration. Show all posts
Showing posts with label forward declaration. Show all posts

Wednesday, November 6, 2013

Forward declarations vs includes in headers

What should be included and what can be forward declared in this header ?
class Polygon : public Shape {

public:
    void setBasicCurve (const Bezier& curve);
    void magnify (Vector direction);
    void setPoints (const vector<Point*>& points);

private:
    Plane*             m_surface;
    std::list<Point*>  m_points;
    Color              m_color;
    Bezier&            m_basic_curve;

    static Type        m_shape_type;

};

Here are some practical tips to keep your header files lean.