#include<iostream>
using namespace std;
class All
{
public:
	class Animal_error{};
	class Cat_error:public Animal_error{};
	class Human_error:public Animal_error{};
	void funCat(){throw Cat_error();}
};
void main()
{
	All a;
//开头设置异常基类捕捉
	try{
		a.funCat();	
	}catch(All::Animal_error&){
		cout<<"catch animal"<<endl;
	}
	catch(All::Cat_error&){
		cout<<"catch cat"<<endl;
	}
	catch(All::Human_error&){
		cout<<"catch Human"<<endl;
	}
//末尾设置异常基类捕捉
	try
	{
		a.funCat();	
	}
	catch(All::Cat_error&)
	{
		cout<<"catch cat"<<endl;
	}
	catch(All::Human_error&)
	{
		cout<<"catch Human"<<endl;
	}
	catch(All::Animal_error&)
	{
		cout<<"catch animal"<<endl;
	}
}
