摘要:
使用模板可以创建可重用的代码。模板可以分为两类,一个是函数模板(通用函数),另外一个是类模板(通用类)。函数模板定义了一组应用于不同数据类型的通用运算。- 使用关键字 template 来创建.template <class Type> ret-type func-name(parameter list){ //..}//或者template <class Type> ret-type func-name(parameter list){ //..}其中,Type 是一个占位符,代表函数使用的数据类型.#include <iostream>using nam 阅读全文
posted @ 2012-05-26 12:24
fdyang
阅读(225)
评论(0)
推荐(0)

浙公网安备 33010602011771号