Dynamic Array
you will create 2 classes
RUN ALL THE EXAMPLES, your logging for all 6 mains should match the example logs as close as is possible
StaticArray
and
DynamicArray
-----------------------------------------------------------------------------------------------------------
class StaticArray
-----------------------------------------------------------------------------------------------------------
private members:
string data[5];
functions:
constructor -- log the start and end of the function
destructor -- log the start and end of the function
string ToString() -- return a string representation of the data in the array
overloaded [] operator .. add code to throw and exeption if the requested index is out of bounds
put your class declaration in static_array.h and your function bodies in static_array.cpp
-----------------------------------------------------------------------------------------------------------
class DynamicArray
-----------------------------------------------------------------------------------------------------------
private members:
string * data
int capacity
functions:
constructor -- there will be only one constructor and the copy constructor
DO NOT make a default constructor "DynamicArray()" , you will lose points if you do
DO NOT modify the mains to make it compile without the constructor DynamicArray()
DynamicArray(int val =5);// will work in place of a default constructor DynamicArray() as well
it will have and int parameter
with a default value of 5, look up default values of parameters in c++ if you dont understand
the parameter will be the capacity of the array, the parameter has a default value of 5
set the member capacity with the value passed in
set the pointer "data" to a new dynamic array of size "capacity"
log the start and end of the function
copy constructor
-- the parameter will be a DynamicArray refference
set capacity the same as the one passed in
set your pointer to a new dynamic array
copy the data from the one passed in
destructor -- clean up the dynamic array, call delete [] on the pointer
log the start and end of the function
overloaded [] operator .. add code to throw and exeption if the requested index is out of bounds
string ToString() -- return a string representation of the data in the array
put your class declaration in dynamic_array.h and your function bodies in dynamic_array.cpp
-----------------------------------------------------------------------------------------------------------
copy over all the files provided for you
the files are in the usual place
sample mains have been provided to test both of your classes
the StaticArray class is nearly completed
the DynamicStack files are nearly empty
make sure the output of the provided mains match the runnable examples provided
make sure the output of the log files match as well , you need to implement logging