#include using namespace std; const int num=5; class wrong{}; template class people { public: people(int size=num); ~people(){delete[]p;} T&operator[](int off); const T&operator[](int off)const; int GetSize()const{return size;} class offset { public: offset(int Size):size(Size){} ~offset(){} virtual int Get(){return size;} virtual void show() { cout<<"抛出offset异常\n"; cout<<"下标值"< people::people(int Size):size(Size) { cout<<"调用构造函数\n"; if (Size==0) { throw Zero(Size); } if (Size<10) { throw Small(Size); } if (Size>10000) { throw Big(Size); } if (Size<1) { throw Nav(Size); } p=new T[size]; for (int i=0;i T&people::operator[](int off) { int size=GetSize(); if (off>=0&&off const T&people::operator[](int off)const { int Size=GetSize(); if (off>=0&&off one(0); for (int i=0;i<100;i++) { one[i]=i; cout<<"one["<::Small &small) { small.show(); } catch (people::offset &off) { off.show(); } catch (...) { cout<<"程序出现异常"<