Stroustrup's GUI Interface Library Question

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:

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)?
Last edited on
draw_lines() is called from Shape::draw(), which is called from Window::draw().

Thanks for the fast reply! But I still don't get who calls Window::draw()? I thought it would be called in Window::attach() when you attach a shape to a window, but it's not.
The Window::draw() function is a virtual function and is called from somewhere in the FLTK library.
Thanks again!
Topic archived. No new replies allowed.