operator[][] C++

前端 未结 5 1393
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-15 16:24

I\'d like to overload operator[][] to give internal access to a 2D array of char in C++.

Right now I\'m only overloading operator[], which goes

5条回答
  •  礼貌的吻别
    2021-02-15 17:23

    As far as I know there is no such thing as operator[][]. What you can do is you could return from your operator[] method something that has overloaded operator[].

    Actually you are doing it now, because you return char* which can be indexed using [] again.

提交回复
热议问题