摘要:
//第二十四章 异常和错误处理 6异常类与模板的关系#include <iostream>using namespace std;const int num=5; class wrong{};template<class T>class people{public: people(int Size=num); ~people(){ delete []p; }; int&operator[](int off); const int&operator[](int off)const; int GetSize()const{ return size;} //c 阅读全文
摘要:
//第二十四章 异常和错误处理 5异常类的虚函数#include <iostream>using namespace std;#include <iostream>using namespace std;const int num=5; class people{public: people(int Size=num); ~people(){ delete []p; }; int&operator[](int off); const int&operator[](int off)const; int GetSize()const{ return size 阅读全文
摘要:
//第二十四章 异常和错误处理 4创建异常类的成员函数#include <iostream>using namespace std;#include <iostream>using namespace std;const int num=5; class people{public: people(int Size=num); ~people(){ delete []p; }; int&operator[](int off); const int&operator[](int off)const; int GetSize()const{ return s 阅读全文