home *** CD-ROM | disk | FTP | other *** search
/ Microsoftware Monthly 19…2 Programming Power Tools / MASO9512.ISO / cpptutor / cpptutor.arj / CH09 / F091921.FLD < prev    next >
Encoding:
Text File  |  1993-10-06  |  2.0 KB  |  1 lines

  1. ╘// example of overloading the [] operator                                                        // Part 1 of 2                                                                                     ╦typdef stuct LongPair ╦{long x╦, y╦;};╘ //use to store pair of numbers                 ╦class Grade╦{                                                                                    ╘ // use to manage associative array of grades                                                 ╦public:                                                                                             ╘//  use to represent association                                                                 ╦typedef struct { char     letter╦[4╦];                                                                      LongPair range╦;} GradeAssoc╦;                                           ╦private:                                                                                            static GradeAssoc GradeList╦[]; ╘      // the associative array                             ╦public:                                                                                             char* operator[]( int numeric╦); ╘    // returns the letter grade                              LongPair ╦operator[]( char* p╦); ╘     // returns the numeric grade                      ╦}