📄 ufactory.cpp
字号:
// UFactory.cpp: implementation of the UFactory class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include <stdio.h>
#include "UFactory.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
UFactory* UFactory::_ptr = NULL; // 初始化静态成员
UFactory::UFactory()
{
}
UFactory::~UFactory()
{
}
// 获取系统唯一对象的指针
UFactory* UFactory::GetPtr()
{
if( _ptr == NULL ){ // 如果该对象还没有创建,则创建之
_ptr = new UFactory();
}
return _ptr;
}
// 释放对象
void UFactory::Release()
{
if( _ptr != NULL ){ // 如果该对象已经创建,则释放之
delete _ptr;
_ptr = NULL;
}
}
void UFactory::print()
{
printf("\n i am an unique object factory!");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -