Question: Please help!. I tried implementing those 3 classes of code below, but at the moment I am stuck, I am confused on what to do
Please help!. I tried implementing those 3 classes of code below, but at the moment I am stuck, I am confused on what to do about implementing those 3 classes of code below. Please put me through.
Objective:
The objective of this homework is to write a templated class which contains operator overloading, exceptions, which allows for the safe use of arrays..
Task 1: Implement the templated SmartArray class!
Your task is to extend the SmartArray class done in class. Specifically, implement the following functions:
Operator+ : Given two SmartArrays, return a new SmartArray with the elements of the two concatenated together.
operator== : Given two SmartArrays, return true if the two are the same length and contain the same data elements.
count(T) : Given some value, return the number of times that element exists in the SmartArray
Task 2: Add tests to validate the 3 new functions above. In total you should have at least 3 tests per class member function.
#ifndef SMART_ARRAY_H #define SMART_ARRAY_H
/* @file SmartArray.cpp @author < Fill Me In > @date < Fill Me In >
@description Implements a class for an array with bounds checking. Implementatoin is below the declaration in this same file. */
#include
// There is no need to change this!
using namespace std;
template
T& operator[](int); // Set data in array
int size() const; SmartArray
/************** Now the implementation ******************************/
template
template
template
template
template
template
template
template
#endif
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
