Jiskha Homework Help
SATURDAY
November 21, 2009
SCHOOL SUBJECTS
- Art
- Business
- Computers
- English
- Foreign Languages
- Health
- Home Economics
- Math
- Music
- Physical Education
- Science
- Social Studies
GRADE LEVELS
- Preschool
- Kindergarten
- Elementary School
- 1st Grade
- 2nd Grade
- 3rd Grade
- 4th Grade
- 5th Grade
- 6th Grade
- 7th Grade
- 8th Grade
- High School
- 9th Grade
- 10th Grade
- 11th Grade
- 12th Grade
- College
- Adult Education
Post a New Question | Current Questions | Chat With Live Tutors

Homework Help Forum: Computers

Posted by Dave 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 - MathMate, 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:
    http://www.deitel.com/articles/cplusplus_tutorials/20060204/

Answer this Question

First Name:
School Subject:
Answer:

SEARCH

COMMUNITY
FEATURES
- Live Tutors
- Net Riddle
- Reference
- Search