Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'          constructors-point-rectangle/boiled-down-for-notes-cpp11/rect.cc - Implementation of the Rectangle class constructors.Lecture 4 - slide 5 : 40
Program 4

// Definition of methods with constructor chaining for class Rectangle 

#include <cmath>
#include <iostream>
#include "rect.h"

Rectangle::Rectangle(): Rectangle{-1, 1, 1,-1}{
}

Rectangle::Rectangle(double x1, double y1, double x2, double y2):
      Rectangle{Point{x1, y1}, Point{x2, y2}} {
}

Rectangle::Rectangle(Point p1, Point p2): upper_left{p1}, lower_right{p2}{
}