// // Created by Nik on 10/04/2022. // #include "Rectangle.h" #include Rectangle::Rectangle(ColorCode color, unsigned int width, unsigned int height) : Shape2D(color), width(width), height(height) {} Rectangle::Rectangle(ColorCode color, unsigned int size) : Shape2D(color), width(size), height(size) {} unsigned int Rectangle::getSurfaceArea() const { return width * height; } void Rectangle::draw() const { for (int i = 0; i < height; i++) { PrintUtility::print(color, width); std::cout << "\n"; } std::cout << "\n"; } std::string Rectangle::getString() const { std::string ret; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) ret += " *"; ret += "\n"; } ret += "\n"; return ret; }