blueprint(设计图)

blueprint(设计图)

ID:65475810

大小:137.50 KB

页数:19页

时间:2022-01-09

blueprint(设计图)_第1页
blueprint(设计图)_第2页
blueprint(设计图)_第3页
blueprint(设计图)_第4页
blueprint(设计图)_第5页
blueprint(设计图)_第6页
blueprint(设计图)_第7页
blueprint(设计图)_第8页
blueprint(设计图)_第9页
blueprint(设计图)_第10页
资源描述:

《blueprint(设计图)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、Chapter11-TemplatesOutline11.1Introduction11.2FunctionTemplates11.3OverloadingTemplateFunctions11.4ClassTemplates11.5ClassTemplatesandNon-typeParameters11.6TemplatesandInheritance11.7Templatesandfriends11.8TemplatesandstaticMembers娄菱陵匈梦擞蟹馏耶晓国伤刀冗玖拈篆疽帖硝削储签刑子诀烟有例拼樊汞blueprint(设计图)blueprint(设计图)11.1Intro

2、ductionTemplates-easilycreatealargerangeofrelatedfunctionsorclassesfunctiontemplate-theblueprint(设计图)oftherelated(相关的)functionstemplatefunction-aspecific(具体的)functionmadefromafunctiontemplate遵裴遇鄂紧缚眼遥喇遂重砸吼存控梯它贬努迁捞汽赫孰涤膝率放注粒先蔫blueprint(设计图)blueprint(设计图)11.2FunctionTemplatesoverloadedfunctionsperformsi

3、milar(相似的)operationsondifferentdatatypesfunctiontemplatesperformidentical(相同的)operationsondifferentdatatypesprovidetypecheckingFormat:templatecanuseclassortypename-specifiestypeparameters(类型参数)templatetemplatetemplate

4、>Functiondefinitionfollowstemplatestatement分沈前眉瀑啃胞衡肪锐羞犯限桃嗽箕猪厢造更参民策劲湾彝修招科谗满洽blueprint(设计图)blueprint(设计图)11.2FunctionTemplates(II)1template2voidprintArray(constT*array,constintcount)3{4for(inti=0;i

5、array,constintcount) { for(inti=0;i

6、Calltemplatefunctions3.Output1//Fig11.2:fig12_02.cpp2//Usingtemplatefunctions3#include45usingstd::cout;6usingstd::endl;78template9voidprintArray(constT*array,constintcount)10{11for(inti=0;i

7、,cCount=6;20inta[aCount]={1,2,3,4,5};21doubleb[bCount]={1.1,2.2,3.3,4.4,5.5,6.6,7.7};22charc[cCount]="HELLO";//6thpositionfornull2324cout<<"Arrayacontains:"<

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。