diff --git a/misc/rect.h b/misc/rect.h --- a/misc/rect.h +++ b/misc/rect.h @@ -66,6 +66,10 @@ * this makes sure p is in the rect, extending it if necessary... */ void setContains( const Coordinate &p ); + /** + * Assignment operator. + */ + Rect& operator=( const Rect& other ); /** * moves the rect while keeping the size constant... */ diff --git a/misc/rect.cc b/misc/rect.cc --- a/misc/rect.cc +++ b/misc/rect.cc @@ -18,6 +18,18 @@ #include "rect.h" #include "common.h" +Rect& Rect::operator=( const Rect& other ) +{ + if (this != &other) + { + setBottomLeft( other.bottomLeft() ); + setWidth( other.width() ); + setHeight( other.height() ); + } + normalize(); + return *this; +} + bool operator==( const Rect& r, const Rect& s ) { return ( r.bottomLeft() == s.bottomLeft()