#include <iostream>
using namespace std;
template<typename T>
class arr
{
?? ?public:
?? ?int set(int i,T val){if(i==25||i<0)return -1;arr[i]=val;cout<<"set arr[i]= "<<arr[i]<<" i= "<<i<<endl;return 0;};
?? ??? ?int get(int i){cout<<"get arr[i]= "<<arr[i]<<endl;};
?? ??? ?T &operator [](int i)
?? ??? ?{
?? ??? ?return arr[i];
?? ??? ?}
?? ?private:
?? ??? ?T arr[25];
};
int main()
{
?? ?arr<int> myarr;
?? ?int res=0;
?? ?for(int i=0;i<25;i++)
?? ??? ?res=myarr.set(i,(i+1)*2);
?? ?if(res<0)
?? ??? ?cout<<"数组下标错误"<<endl;
?? ?myarr.set(5,66);
? ?? ?myarr.get(5);
?? ?return 0;
}
?