Untitled
unknown
plain_text
a year ago
602 B
5
Indexable
#include "drawing.h" #include "point.h" #include "polygon.h" #include <iostream> using namespace std; Drawing::Drawing() { // Constructor logic if needed } Drawing::~Drawing() { // Clean up allocated shapes for (Shape* shape : shapes) { delete shape; } shapes.clear(); } void Drawing::AddPoint(Point *point) { shapes.push_back(point); } void Drawing::AddPolygon(Polygon *polygon) { shapes.push_back(polygon); } void Drawing::ShowDrawing(void) { for (Shape* shape : shapes) { shape->Draw(); // Assuming Shape class has a virtual Draw method } }
Editor is loading...
Leave a Comment