Is it possible to implement something like a double []
, in order to call a method of my object like this: obj[x][y]
?
Asked
Active
Viewed 79 times
0

Natjo
- 2,005
- 29
- 75
-
1[relevant](https://stackoverflow.com/questions/994488/what-is-proxy-class-in-c) – jaggedSpire Sep 22 '17 at 14:43
-
See [C++ FAQ - How do I create a subscript operator](http://www.cs.technion.ac.il/users/yechiel/c++-faq/matrix-subscript-op.html) – Thomas Matthews Sep 22 '17 at 17:25
1 Answers
4
Yes. You can have the regular class operator[] return a special "proxy object" which has its own operator[] to return the final values.

John Zwinck
- 239,568
- 38
- 324
- 436
-
-
I think I found a working example: https://stackoverflow.com/questions/6969881/operator-overload – Natjo Sep 22 '17 at 14:45