2 Dimension Subscript Operator Overload?

Pages: 12
So basically
M22::TmpM22
from M22::TmpM22 M22::operator [](int lhs) is like saying that the return class shall be TmpM22 which is a nested class of M22. Hence, M22::TmpM22? And since we are overloading the [] operator for M22, it translates to M22::operator[] (int rhs)?

I didn't know if i wanted to create a TmpM22 class, i must do it via M22::TmpM22 t ( 1, m.a, m.b, m.c, m.d, 0 ). So i am just wondering the first "[]" for m[1][1], the operator overload [] for M22 is called, which then return TmpM22(1,this->a,this->b,this->c,this->d,0) so it creates a unnamed instance class of TmpM22, which is equivalent to tmpM22(1)[1] like how you explained above?
1) Yes. Yes.



2) Yes
m[1][2]:
[1] is M22::operator [] and returns a M22::TmpM22
[2] is M22::TmpM22::operator [] and returns an int
Thanks Bazzy for being so patient with me! You have helped me so much, couldn't have done it without your help.
Topic archived. No new replies allowed.
Pages: 12