• 首页
  • 期刊简介
  • 编委会
  • 投稿指南
  • 收录情况
  • 杂志订阅
  • 联系我们
引用本文:闵 军,罗 泓.C++11实现可变参数泛型抽象工厂[J].软件工程,2017,20(5):18-22.【点击复制】
【打印本页】   【下载PDF全文】   【查看/发表评论】  【下载PDF阅读器】  
←前一篇|后一篇→ 过刊浏览
分享到: 微信 更多
C++11实现可变参数泛型抽象工厂
闵 军,罗 泓
(宜宾学院,四川 宜宾 644000)
摘 要: 由于抽象工厂模式有利于达到高内聚低耦合的设计目的,因此在软件设计中得到广泛应用。但抽象工厂模 式的传统实现方式在处理具体产品构造函数参数不同、异类组合、具体产品数量繁多的情况时,都显得很繁琐、很困 难、复用性很低。针对这一问题,本文以抽象工厂模式为例,应用C++11新标准和泛型编程技术,提出一种C++11可 变参数泛型抽象工厂的实现方式。实验结果表明,该方式比传统实现方式更为简洁高效、复用性更强,优雅地实现了对 产品类型可变、参数可变、异类组合的支持。该实现方式及代码具有实用性,可应用到软件项目中。
关键词: C++11;泛型;可变参数;抽象工厂;设计模式
中图分类号: TP311.1    文献标识码: A
The Implementation of the Variable Parameter Generic Abstract Factory in C++11
MIN Jun,LUO Hong
( Yibin University, Yibin 644000, China)
Abstract: As the abstract factory pattern is conducive to the achievement of high cohesion and low coupling design,it has been widely applied in software design.But the traditional implementation models of the abstract factory design pattern are cumbersome and difficult with poor reusability,when dealing with the concrete product constructor of different parameters,heterogeneous combination and miscellaneous concrete products.Focusing on the problem and taking the abstract factory as an example,the paper adopts the new C++11 standards and generic programming technology to present an implementation model of the C++11 variable parameter generic abstract factory.Experimental results show that this model is more concise and more efficient with better reusability than the traditional implementation models.This model gracefully implements the support for variable product types,variable parameters and heterogeneous combination.With good practicability,the implementation model and its code can be applied in software projects.
Keywords: C++11;generic;variable parameter;abstract factory;design pattern


版权所有:软件工程杂志社
地址:辽宁省沈阳市浑南区新秀街2号 邮政编码:110179
电话:0411-84767887 传真:0411-84835089 Email:semagazine@neusoft.edu.cn
备案号:辽ICP备17007376号-1
技术支持:北京勤云科技发展有限公司

用微信扫一扫

用微信扫一扫