Question
Please help fill in the code to implement an array class for characters. /* Comments help to know what to do in each function. Needs
Please help fill in the code to implement an array class for characters. /* Comments help to know what to do in each function. Needs to be in C++
/**
* Set a new size for the array. If \a new_size is less than the current
* size, then the array is truncated. If \a new_size if greater then the
* current size, then the array is made larger and the new elements are
* not initialized to anything. If \a new_size is the same as the current
* size, then nothing happens.
* The array's original contents are preserved regardless of whether the
* array's size is either increased or decreased.
* @param[in] new_size New size of the array
*/
void resize (size_t new_size);
/// Shrink the array to reclaim unused space.
void shrink ();
/**
* Locate the specified character in the array. The index of the first
* occurrence of the character is returned. If the character is not
* found in the array, then -1 is returned.
* @param[in] ch Character to search for
* @return Index value of the character
* @retval -1 Character not found
*/
int find (char ch) const;
/**
* @overload
* This version allows you to specify the start index of the search. If
* the start index is not within the range of the array, then the
* std::out_of_range exception is thrown.
* @param[in] ch Character to search for
* @param[in] start Index to begin search
* @return Index value of first occurrence
* @retval -1 Character not found
* @exception std::out_of_range Invalid index
*/
int find (char ch, size_t start) const;
/**
* Test the array for equality.
* @param[in] rhs Right hand side of equal to sign
* @retval true Left side is equal to right side
* @retval false Left side is not equal to right side
*/
bool operator == (const Array & rhs) const;
/**
* Test the array for inequality.
* @param[in] rhs Right-hand size of not equal to sign
* @retval true Left side is not equal to right side
* @retval false Left size is equal to right side
*/
bool operator != (const Array & rhs) const;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started