0

Example: I want to have a class foo with members a and b and access these members as if the class was an array.
foo[0] would return foo.a and foo[1] would return foo.b if that makes sense

I Tried searching online for a couple hours and didn't find anything that came close, I know its possible but I have no idea what its called so I've been unable to find help about it so far.

  • @BaummitAugen: I admit this is not a very good question, but I highly doubt that OP can understand how the answers to the related question can answer his own problem... – Serge Ballesta Feb 22 '16 at 14:40
  • The proposed duplicate explains *how* you can use overloaded operators. The direct answer to your question is *use `operator []`*. With the help of the answers to the other question, it should solve your problem. At least you will be able to ask a more precise non duplicate question :-) – Serge Ballesta Feb 22 '16 at 14:43
  • @SergeBallesta I figured he first reads the *"General Syntax"* part and then moves on to the *"Array Subscript"* paragraph over there. That should do the trick for the motivated beginner, shouldn't it? – Baum mit Augen Feb 22 '16 at 14:46

0 Answers0