c++设计模式
文章平均质量分 73
learn123_net
http://learn123.net There are lots of products in the market that make you dazzled and you dont know how to make a choice. In here we introduce the latest fashion and popular treands. Therefore you learn it first,and then buy the goods that you bes
展开
-
c++设计模式--抽象工厂模式
在上期再谈工厂模式,王老板加盟了烤鸭店,几个月后,王老板想得到更多的利益,于是想了个主意----在烤鸭源材料上偷工减料。果然,这招让王老板大赚特赚。一个月后,北京总店发现,北京烤鸭的口碑越来越差,经过一翻调查,终于发现了原因,于是,冥思苦想,最后决定在原料上把关----因地制宜,所有城市的烤鸭都要求特制的源材料。于是委托Fish写了如下程序:抽象工厂模式。顺便解释一下,在SaurceFactory原创 2013-06-12 09:15:16 · 593 阅读 · 0 评论 -
再谈工厂模式
导入问题:北京烤鸭实在是太受欢迎了,于是王老板想在上海也投资烤鸭店,不过,他要求要加入上海的特色口味。 Fish在前一文c++设计模式--工厂模式,介绍的其实只是简单工厂模式,为了解决烤鸭店的加盟问题,今天,就然Fish再介绍一下工厂模式,在这里,为了偷懒,就用java语言实现了。 代码如下:package com.piniheaven;publ原创 2013-06-11 13:36:38 · 683 阅读 · 0 评论 -
c++设计模式--类适配器模式
注:重看了以前自己写的设计莫式,总感觉代码太多,掩盖了问题的实质。从本文开始,将会一切从简。1.类适配器模式UML图: 2.实现代码: class Taget{ public: virtual void request(){cout};class Adaptee{ pub原创 2013-07-08 15:08:14 · 615 阅读 · 0 评论 -
C++设计模式--观察者模式
何为观察者模式?这里先引出一个大家熟悉的程序。package com.piniheaven;import java.awt.BorderLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import ja原创 2013-06-11 17:40:33 · 685 阅读 · 0 评论