// 类模板中的类型名字可以屏蔽定义外部的名字 #include < iostream > #include < string > using namespace std; // 模板外部对double起了个类型别名T typedef double T;template < typename T > void show( const T & t) ... { // 模板内部的T已经不是外部那个double别名T // 外部的T被屏蔽 T k(t); cout << k << endl; return ;} int main() ... { T t = 3.14; string str("yao"); show(str); show(t); getchar(); return 0;}