【发布时间】:2011-04-20 07:15:35
【问题描述】:
构造函数定义中的print语句没有被打印出来,是不是main中的构造函数调用正确?我知道我在这里遗漏了一些要点,请指出。
#include <iostream>
#include <typeinfo>
template <typename T> class List
{
public:
template <typename T2> List (List<T2> const&);
};
template <typename T> template <typename T2> List <T> :: List (List <T2> const&)
{
std :: cout << "\nType name:" << typeid (T2).name();
}
int main ()
{
List <int> kk (List <int>);
return 0;
}
【问题讨论】:
标签: c++ templates typeid most-vexing-parse