I have been given a .h file, based on which I need to implement a class that simulates some functions of the array in c++. There are two given instance variables in the .h file
int *array; /* The dynamic array holding the elements */
int nElements; /* The number of elements in the array */
I tried the following as the class constructor (though I know it won't work before I did so):
IntArray::IntArray(int n)
{
array = new IntArray[n];
nElements = n;
}
What should I write to make the constructor work?
This is the original .h file for reference. [1]: https://mega.nz/file/P0FVkBCQ#ME3fK_U7-H8iVHLMC7tyCCKxF-xbCMphEaERunZ-y9c