Write a program to overload the function call operator ( ) so as to allow the more common form of double-array subscripting. Therefore, instead of saying: chessBoard[row][column] for an array of objects, overload the function call operator to allow the alternate form: chessBoard(row, column) A sample output of your program should look like follows: The value of each array element is the product of the row and column values. Using the class definition given in the myClassOperator.h header file below, implement the class member functions and driver code in separate files.

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter7: Input/output Technology
Section: Chapter Questions
Problem 1VE
icon
Related questions
Question

Write a program to overload the function call operator ( ) so as to allow the more common form of double-array subscripting. Therefore, instead of saying:

chessBoard[row][column]

for an array of objects, overload the function call operator to allow the alternate form: chessBoard(row, column)

A sample output of your program should look like follows:

The value of each array element is the product of the row and column values. Using the class definition given in the myClassOperator.h header file below, implement the class member functions and driver code in separate files.

 

#ifndef CLASSOPERATOR H
#define CLASSOPERATOR H
class myCall0perator {
public:
myCall0perator ();
// overloaded function call operator
int operator (0 ( int, int ) ;
private:
int chessBoard[ 8 ][ 8 ];
};
#endif
Transcribed Image Text:#ifndef CLASSOPERATOR H #define CLASSOPERATOR H class myCall0perator { public: myCall0perator (); // overloaded function call operator int operator (0 ( int, int ) ; private: int chessBoard[ 8 ][ 8 ]; }; #endif
chessBoard (1, 7) is 7
chessBoard (3, 5) is 15
chessBoard (8, 2) is 16
Transcribed Image Text:chessBoard (1, 7) is 7 chessBoard (3, 5) is 15 chessBoard (8, 2) is 16
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage