#include "Rectangle.hpp" Rectangle::Rectangle(int w, int h) { width = new (nothrow) int; height = new (nothrow) int; if(width == NULL || height == NULL) { cerr << "Memory allocation failure!\n"; exit(-1); } *width = w; *height = h; cout << "Constructing rectangle (w:"<< *width <<", h:"<<*height<<")\n"; } Rectangle::~Rectangle() { cout << "Destructing rectangle (w:"<< *width <<", h:"<<*height<<")\n"; delete width; delete height; } void Rectangle::setWidth(int w) { *width = w; } void Rectangle::setHeight(int h) { *height = h; } int Rectangle::getWidth() { return *width; } int Rectangle::getHeight() { return *height; }