diff options
Diffstat (limited to 'Rectangle.h')
-rw-r--r-- | Rectangle.h | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/Rectangle.h b/Rectangle.h index 8a61321..5e7bb94 100644 --- a/Rectangle.h +++ b/Rectangle.h @@ -18,13 +18,9 @@ class Rectangle { Vertex v1, v2; public: Rectangle() {} - Rectangle(const Vertex& v1, const Vertex& v2) { - this->v1 = v1; this->v2 = v2; - } - Rectangle(double x, double y, double width, double height) { - v1.setLocation(x, y); - v2.setLocation(x+width, y+height); - } + Rectangle(const Vertex& vertex1, const Vertex& vertex2) : v1(vertex1), v2(vertex2) {} + Rectangle(double x, double y, double width, double height) + : v1(x, y), v2(x+width, y+height) {} Vertex &getVertex1() {return v1;} const Vertex &getVertex1() const {return v1;} |