摘要:
定义一个类一般都是在头文件中进行类声明,在cpp文件中实现,但使用模板时应注意目前的C++编译器还无法分离编译,最好将实现代码和声明代码均放在头文件中。如:test.htemplate <class T>class CTest{ public: T& GetValue(); void SetValue(const T& _Value);protected: T m_Value;};test.cpptemplate <class T>T& CTest<T>::GetValue(){ return m_Value; }template&l 阅读全文
posted @ 2011-09-22 12:23
byfei
阅读(301)
评论(0)
推荐(0)

浙公网安备 33010602011771号