I am reading "Programming Principles and Practice Using C++" by Bjarne Stroustrup. I am currently on chapter 13. The chapter is about GUI programming, the purpose of which is to get you used to reading other people's code and using libraries. Here are the libraries I use:
http://www.stroustrup.com/Programming/Graphics/
http://www.stroustrup.com/Programming/FLTK/
The thing I don't understand is that every class, like
Rectangle
,
Polygon
, ect... which is from the base class
Shape
has a function
void draw_lines() const
which draws the lines of a shape (it is different for each shape), but
void draw_lines() const
is not called in any of the constructors of the classes such as
Rectangle
,
Polygon
, ect... The only function called in the constructors of those classes is
void Shape::add(Point p)
, it adds a
Point
to the member variable
vector<Point> Shape::points
(basically
Point
is a coordinate system for the window. So when you make an object of
class Rectangle
you pass all the arguments and it calls
void Shape::add(Point p)
, but it doesn't call
void Shape::Rectangle::void draw_lines()
. My question is how are the lines drawn if
void Shape::Rectangle::void draw_lines()
isn't called in the constructor or in
void Shape::add(Point p)
?