okay so basically yes I need help with my homework Im not even going to lie lol^^; so one thing we have to do is get all these methods to work together in harmony till the complier program we house our labs in says pass image of complier showing the pass or fail messages
here is another image of the complier and how it will show the pass or fail based on the result when ran
so i have the following things i need help on , so the default since it shows pass i believe i did that correctly and there are some other things in this i still need help on so and yes i have been putting in effort myself i just well pointers have always screwed me up xD thanks in advance .
template<typename Type>
class DynArray {
friend class TestSuite; // Giving access to test code
Type* mArray;
unsigned int mSize;
unsigned int mCapacity;
public:
// Default constructor
// Creates a new object
// In: _startingCap An initial capacity to start the array at (optional)
DynArray(unsigned int _startingCap = 0)
{
mArray = new Array[strlen(_startingCap) + 1];
strcpy_s(mArray, strlen(_startingCap) + 1, _startingCap);
}
// Destructor
// Cleans up all dynamically allocated memory
~DynArray()
{
delete[] mArray;
}
// Copy constructor
// Used to initialize one object to another
// In: _da The object to copy from
DynArray(const DynArray& _da)
{
*this = _da;
}
// Assignment operator
// Used to assign one object to another
// In: _da The object to assign from
//
// Return: The invoking object (by reference)
// This allows us to daisy-chain
DynArray& operator=(const DynArray& _da) {
}
// Overloaded [] operator
// Used to access an element in the internal array (read-only)
// In: _index The index to access at
//
// Return: The item at the specified index (by reference)
const Type& operator[](int _index) const
{
}
// Overloaded [] operator
// Used to access an element in the internal array (writeable)
// In: _index The index to access at
//
// Return: The item at the specified index (by reference)
Type& operator[](int _index) {
}
// Get the current number of elements actively being used
//
// Return: The current number of elements used
int Size() const {
}
// Get the current capacity of the internal array
//
// Return: The capacity of the array
int Capacity() const {
}
// Clear the class for re-use
// Should clean up all dynamic memory and leave the object the same as if the default constructor had been called
void Clear() {
}
// Add an item to the end of the array
// Should resize the array if needed
// In: _data The item to be added
void Append(const Type& _data) {
}
// Resizes the internal array, and copies all data over
// In: _newCapacity The new capacity of the array
// NOTE: If 0 is passed, the array should double in size
// If _newCapacity < mCapacity, do nothing
//
// SPECIAL CASE: If mCapacity is 0, then it should be set to 1
void Reserve(unsigned int _newCapacity = 0)
{
if (_newCapacity < mCapacity)
{
continue;
}
if (mCapacity = 0)
{
mCapacity = 1;
}
}
};
#endif