Код: Выделить всё
template
class X
{
int _size;
T *container;
public:
X(int sz)
{
_size=sz;
container=new T[sz]();
}
~X()
{
}
T& operator [](int indx)
{
return container[indx];
}
};
Код: Выделить всё
int main() {
X sample(100);
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/22980171/array-subscripting-returning-reference-vs-proxy-class-method[/url]