---- 整理自狄泰软件唐佐林老师课程
下面的程序想要表达什么意思?


早期的C++直接复用class关键字来定义模板
但是泛型编程针对的不只是类类型
class关键字的复用使得代码出现二义性
自定义类类型内部的嵌套类型
不同类中的同一个标识符可能导致二义性
编译器无法辨识标识符究竟是什么


下面的程序想要表达什么意思?

#include
#include
using namespace std;
int func(int i, int j) throw(int, char)
{
if( (0 < j) && (j < 10) )
{
return (i + j);
}
else
{
throw '0';
}
}
void test(int i) try
{
cout << "func(i, i) = " << func(i, i) << endl;
}
catch(int i)
{
cout << "Exception: " << i << endl;
}
catch(...)
{
cout << "Exception..." << endl;
}
int main(int argc, char *argv[])
{
test(5);
test(10);
return 0;
}

