// Example of the template keyword
template <class T, int i> class TestClass {
public:
char buffer[i];
T testFunc(T* p1 );
};
template <class T, int i>
T TestClass<T,i>::testFunc(T* p1) {
return *(p1++)
};
// To create an instance of TestClass
TestClass<char, 5> ClassInst;
以上程序编译通过,但是连接有问题,请教高手![]()
博客给出了一个C++使用template关键字定义模板类TestClass的示例,包含成员变量buffer和成员函数testFunc。程序编译通过,但连接出现问题,博主向高手请教解决办法。
521

被折叠的 条评论
为什么被折叠?



