Prototype设计模式其实就是利用一个深拷贝的功能,在原有的类中,通过一个clone函数,创建一个新的类,并可以利用好原有的数据。
这样可以轻易clone出多个新的对象操作,而且都有各自的内存空间。
#include
#include
using namespace std;
class MultiData
{
protected:
bool b;
char c;
s...
分类:
其他好文 时间:
2014-08-02 18:28:43
阅读次数:
231
其实本设计模式可以实现一些像人工智能式的问答。
这个跟人回答问题差不多,根据不同的问题作出不同的回答,而且在不同的状态,也会作出不同的回答。
如果有大量的数据,那么就可以作出千变万化的问答效果来哦。
#include
enum STATE
{
HUNGARY, EAT, FULL
};
class State
{
STATE myState;
public:
State(STA...
分类:
其他好文 时间:
2014-08-02 18:27:43
阅读次数:
200
Abstract Factory Design Pattern 就是一般的Factory Design Pattern的进一步设计,增加一个抽象工厂,然后利用这个工厂可以创建不同基类的类。
当我们需要创建更多不同类的时候就可以使用这个设计模式了。
这个设计模式的代码相对会多点,但是其中的思想就是一般Factory Design Pattern,然后集合更多的基类,看起来挺大的一个设计模式,其思...
分类:
其他好文 时间:
2014-08-02 18:24:53
阅读次数:
250
Hang Up the System
Time Limit: 2 Seconds Memory Limit: 32768 KB
You're going to design a multi-task operating system for an embedded system. Because the resources are limited on this mini c...
分类:
其他好文 时间:
2014-08-02 18:22:13
阅读次数:
328
2013-07-26 写过一篇《CentOS 6.3下 安装 Mono 3.2 和Jexus 5.4》,CentOS 7在CentOS 6的基础上有很大的调整,本文是这篇文章的更新,主要介绍CentOS 7下安装Mono 3.4 和 Jexus 5.6。 CentOS是一个基于RHEL的Linux发...
分类:
其他好文 时间:
2014-08-02 18:14:33
阅读次数:
325
一些废话Unity 的开发者们,尤其是微软系的Unity开发者们,用Mono是不是烦死了?你是不是跟我一样,用vs来写代码,用Mono来跟踪调试?好麻烦啊好麻烦。也许你会说,傻逼你不会用UnityVS插件么?我会说,我擦那不是收费的么?你会说,傻逼你不知道世界上有个东西叫盗版么?我说,嗯,但是还是觉...
分类:
其他好文 时间:
2014-08-02 15:10:43
阅读次数:
184
倍增法在线LCA.....
ZOJ Problem Set - 3195
Design the city
Time Limit: 1 Second Memory Limit: 32768 KB
Cerror is the mayor of city HangZhou. As you may know, the traffic system of thi...
分类:
其他好文 时间:
2014-08-01 23:07:52
阅读次数:
321
1. Don‘t design your page, and then change it with DOM manipulations In jQuery, you design a page, and then you make it dynamic. This is because jQuery was designed for augmentation and has grown i...
分类:
Web程序 时间:
2014-08-01 14:01:12
阅读次数:
1354
C -Design the cityTime Limit:1000MSMemory Limit:32768KB64bit IO Format:%lld & %lluDescriptionCerror is the mayor of city HangZhou. As you may know, th...
分类:
其他好文 时间:
2014-08-01 09:12:51
阅读次数:
336
原帖:http://stackoverflow.com/questions/1673841/examples-of-gof-design-patterns
提问:我正在学习GoF的《设计模式》,想了解些它们在实际中的应用的例子。大家能给我举一些使用设计模式的好例子吗?尤其是在Java类库中。
赞同最高的回答:
你可以通过Wikipedia对设计模式有个整体上的理解。Wikipedia上也...
分类:
编程语言 时间:
2014-07-31 20:49:37
阅读次数:
427