Untitled

mail@pastecode.io avatar
unknown
plain_text
20 days ago
602 B
2
Indexable
Never
#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
    }
}
Leave a Comment