QtDesignPatterns/facadepattern/shapemaker.h

30 lines
450 B
C
Raw Permalink Normal View History

2024-02-06 17:21:37 +08:00
#include "interface.h"
class ShapeMaker
{
public:
ShapeMaker()
{
this->circle = new Circle();
this->square = new Square();
this->rectangle = new Rectangle();
}
void drawCircle()
{
circle->draw();
}
void drawSquare()
{
square->draw();
}
void drawRectangle()
{
rectangle->draw();
}
private:
Shape *circle;
Shape *square;
Shape *rectangle;
};