[solved] – Question 79815
Given the following Array class definition, write a new overloaded operator function for the ‘%’ (modulus) operator (i.e., return an array object that contains the remainders of divide operations between corresponding values in two array objects.) Write the code that would be required in the Array.cpp file. This new function must check for divide by 0.
E.g., array3 = array1 % array2;
class Array
{
public:
Array( int = 10 );
~Array( );
int getSize( ) const;
const Array &operator= ( const Array & );
bool operator==( const Array & ) const;
int &operator[ ]( int );
private:
int size; // Size of the array (number of elements)
int *ptr; // Pointer to the first element of the array
}
Expert Answer
OR

