March 23, 2017

Post a New Question

Posted by on Thursday, September 10, 2009 at 9:18am.

Operator overloading: Array indexing [] – allow for double indexing [][]

I'm not sure how to overload the operator[] for double indexing. Please help if you can. Thanks

  • Computers - , Thursday, September 10, 2009 at 9:33am

    You have not mentioned the language with which you are working. Since Java does not allow operator overloading, I assume you are working with C++. It would be nice to mention "Programming C++" or something similar in your subject.

    Back to arrays. Native C++ already allows double array indexing. Something like the following already works as is, without additional code.

    int a[4][4];
    for(int i=0;i<4;i++)for(int j=0;j<4;j++)...

    If you want to know more about operator overloading in general, you can read up textbooks, or tutorials such as:

Answer This Question

First Name:
School Subject:

Related Questions

More Related Questions

Post a New Question