c++语言数组越界try catch判断

#include<iostream.h> template<class T> class Array {     int i; T *ar; public: Array(int c):i(c){ar=new T[c];} void init(int n,T x){ar[n]=x;} T& operator[](int n) { if(n>=i)throw n; return ar[n];} };
相关文章
相关标签/搜索