constructors-point-rectangle/boiled-down-for-notes-cpp11/prog.cc - Sample Point and Rectangle constructions. | Lecture 4 - slide 5 : 40 Program 6 |
// Sample construction of points and rectangles #include <iostream> #include "rect.h" // In this variant of the program, point.h is included via rect.h int main(){ using namespace std; Point p1{1, 2}, p2{5, -3}; // Two points on the stack. // Four rectangles on the stack: Rectangle r1{}, // Use default constructor r2{1, 2, 5, -3}, // Rectangle from x and y coordinates r3{p1, p2}, // Rectangle from two corner points r4{Point{1, 2}, Point{5, -3}}; // Same // use of points and rectangles // ... }