/*简单异常演示 #include using namespace std; class wrong{}; void error() { cout<<"出错\n"; throw wrong(); } int main() { try { error(); } catch (wrong) { cout<<"该错误已经解决\n"; } return 0; } */ //复杂点的异常演示 #include using namespace std; const int num=5; class people { public: people(int size=num); people(const people&r); ~people(){delete[]p;} people&operator=(const people&); int&operator[](int off); const int&operator[](int off)const; int GetSize()const{return size;} friend ostream&operator<<(ostream&,const people&); class wrong{}; private: int *p; int size; }; people::people(int Size):size(Size) { p=new int[size]; for (int i=0;i=0&&off=0&&off