51 lines
709 B
C++
51 lines
709 B
C++
#pragma once
|
||
#include "common.hpp"
|
||
|
||
typedef enum // ťąĘŔŕĐÍ
|
||
{
|
||
PenTypeLine = 1,
|
||
PenTypeRect = 2,
|
||
PenTypeEllipse = 3
|
||
|
||
}PenType;
|
||
|
||
class Pen
|
||
{
|
||
public:
|
||
Pen(string name);
|
||
virtual PenType getType() = 0;
|
||
string getName();
|
||
private:
|
||
string m_name;
|
||
};
|
||
|
||
class LinePen :public Pen
|
||
{
|
||
public:
|
||
LinePen(string name) :Pen(name) {}
|
||
PenType getType();
|
||
};
|
||
|
||
class RectanglePen :public Pen
|
||
{
|
||
public:
|
||
RectanglePen(string name) :Pen(name) {}
|
||
PenType getType();
|
||
};
|
||
|
||
class EllipsePen :public Pen
|
||
{
|
||
public:
|
||
EllipsePen(string name) :Pen(name) {}
|
||
PenType getType();
|
||
};
|
||
|
||
class PenFactory
|
||
{
|
||
public:
|
||
PenFactory() {};
|
||
Pen* CreatePen(PenType pentype);
|
||
private:
|
||
map<PenType, Pen*> m_PenProduct;
|
||
};
|