博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2014年2月11日

摘要: 原文地址:http://www.eetop.cn/blog/html/93/493893-14903.html在使用类模板技术时,可在.h中实现,也可在.h和.cpp中分开实现,若用.h实现,不要在文件中加入非类模板代码,可避免重写定义错误..1.声明部分1 // Tpl.h 2 template 3 class CTpl 4 { 5 public: 6 CTpl(); 7 virtual ~CTpl(); 8 void Test(T t); 9 }; View Code 2.实现部分 1 // Tpl.cpp 2 #include "... 阅读全文

posted @ 2014-02-11 15:34 lengbingshy 阅读(340) 评论(0) 推荐(0) 编辑