0

I have to write a program that created 2d array but store all data in a dynamically allocated 1d array. I have function definition and I know how to write up other functions but I need to overload operator() to aceess the array.

Here is the definiton :

```
public:
Array(double,double);
Array( const Array &);
~Array();
int getSize() const;
const Array &operator = (const Array &);
bool operator ==(const Array &) const;
bool operator!=(const Array &right) const
{
return!(*this == right);
}
double &operator() (double,double);
double operator() (double, double) const;
private:
int size;
int *ptr;
};
```

Here is the constructor I have defined :-

```
Array::Array(double row, double column)
{
size = row * column;
//int index = 4*row + column;
ptr = new double[size];
for(int i = 0; i<size; i++)
{
ptr[i] = 0;
}
}
```

I don't know how to write up the two functions

double &operator() (double,double);

double operator() (double, double) const;

thanks