#include<iostream>
using namespace std;
template <class T,int n>
class mysequence {
T memblock[N];
public:
void setmember(int x, T value)
{
memblock[x] = value;
}
T getmember(int x) {
return memblock[x];
}
};
int main()
{
mysequence<int, 5>myints;
mysequence<double, 5>myfloats;
myints.setmember(0, 100);
myfloats.setmember(3, 3.1416);
cout << myints.getmember(0) << endl;
cout << myfloats.getmember(3) << endl;
return 0;
}
标签:return,cout,int,memblock,value,模板,setmember From: https://www.cnblogs.com/pinganxile/p/17396445.html