期刊文献+

对简单工厂设计模式的改造 被引量:1

Modification of the Simple Factory Design Pattern
在线阅读 下载PDF
导出
摘要 针对简单工厂设计模式在编程应用中需要用到switch语句,不能动态添加分支以及在用C++语言编程时不能用字符串作为索引等问题,提出了一种利用C++标准库中Map容器来改造简单工厂设计模式的方法,替换switch语句,可以使用字符串作为索引,并且提出了动态添加分支的方法。编写了测试程序,检验了这种方法的有效性。 The switch words have to be used in the simple factory design pattern, and extend branch can' t be added to the pattern, and the string can' t be used as index in the C++, to solve those problem advanced a method to modify the simple factory design pattern by the Standard Template Library of C++, replace the switch words with the map container, which made it possible to use string as the index, and proposed a method to add branch. The test program was given to verify the reliability.
作者 边辰通
出处 《电脑编程技巧与维护》 2013年第4期25-26,共2页 Computer Programming Skills & Maintenance
关键词 设计模式 标准库 容器 design patterns STL container
  • 相关文献

参考文献3

  • 1PeteBecker.C++标准库扩展权威指南[M].史晓明,译.北京:机械工业出版社,2008.
  • 2Stanley B Lippman,Josee Lajoie.C++Primer中文版[M].北京:中国电力出版社,2002.
  • 3P.J.Plauger Alexander A, Stepanov Meng, Lee David, 等.C++STL中文版[M].王昕,译.北京:中国电力出版社,2002.

共引文献1

同被引文献3

引证文献1

相关作者

内容加载中请稍等...

相关机构

内容加载中请稍等...

相关主题

内容加载中请稍等...

浏览历史

内容加载中请稍等...
;
使用帮助 返回顶部