📄 commonfactory.h
字号:
// CommonFactory.h: interface for the CommonFactory class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_COMMONFACTORY_H__4E561F76_09BE_4CBF_87BE_739F36CCCB1B__INCLUDED_)
#define AFX_COMMONFACTORY_H__4E561F76_09BE_4CBF_87BE_739F36CCCB1B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "GraphicFactory.h"
//=================================================================
//普通类工厂(SingleTon)
//=================================================================
class CommonFactory : public GraphicFactory
{
public:
//实例化普通类工厂的唯一实例对象;
static CommonFactory* Instance();
virtual ~CommonFactory();
protected:
//构造函数,不允许客户调用;
CommonFactory();
public:
//创建点图形元素;
virtual Point* CreatePoint (){ return new Point(); }
//创建线图形元素;
virtual Line* CreateLine (){ return new Line(); }
//创建圆图形元素;
virtual Circle* CreateCircle (){ return new Circle(); }
//创建矩形图形元素;
virtual Rect* CreateRectangle(){ return new Rect();}
private:
//类工厂唯一实例指针;
static CommonFactory* m_onlyOneInstance;
//唯一实例是否被实例化标志;
static bool m_onlyOne;
};
#endif // !defined(AFX_COMMONFACTORY_H__4E561F76_09BE_4CBF_87BE_739F36CCCB1B__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -