摘要: 1. 函数可以通过重载进行灵活调用,但是通用性仍不够.此时模板显得更加强大. 如下面所示.//data.h进行声明#include "stdio.h"#include "iostream.h"#include <string>#if !defined(AFX_123)int add(int,int);template <class T1 t1,class T2 t2>double add(T1,T2);#define AFX_123#endif//data.cpp进行定义和调用#include "data.h" 阅读全文
posted @ 2013-01-10 12:44 血洗女生宿舍 阅读(130) 评论(0) 推荐(0) 编辑