0

Create a class DoubleSubscriptedArray,
the class should be able to create an array of any number of rows and any number of columns with dynamic memory allocation. The class should supply operator()
to perform double-subscripting operations. For example, in a 3-by-5 DoubleSubscriptedArray called a, the user
could write a( 1, 3 ) to access the element at row 1 and column 3. The underlying representation of the double-sub-scripted array should be a single-subscripted array of integers with rows * columns number of elements. Function operator()
should perform the proper pointer arithmetic to access each element of the array. There should be two versions of operator()—
one that returns int & so an element of a DoubleSubscriptedArray can be used as an lvalue and one that returns const
int & so an element of a const DoubleSubscriptedArray can be used as an rvalue. The class should also provide the following
operators: ==, !=, =, << (for outputting the array in row and column format) and >> (for inputting the entire array contents).

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by arkoenig
0

this from the book how to program with c++ by deitels but i don't know how to solve

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.