The Rect class

The Rect class holds the four borders of a rectangle: left, top, right, and bottom.


namespace SmallWindows { 
  class Rect; 
  extern const Rect ZeroRect; 
  class Rect { 

The default constructor sets all the four borders to zero. The rectangle can be initialized by, or assigned to, another rectangle. It is also possible to initialize the rectangle with the top-left and bottom-right corners, as well as the top-left corner and a size holding the width and height of the rectangle:

      Rect(int left, int top, int right, int bottom); 
      Rect(const Rect& rect); 
      Rect& operator=(const Rect& rect); 
      Rect(Point topLeft, Point bottomRight); 
      Rect(Point topLeft, Size size); 

Similar to SIZE and POINT in the previous sections, a rectangle ...

Get C++ Windows Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.