Question: C + + #ifndef SimpleVectorOfInts _ SimpleVectorOfInts _ h #define SimpleVectorOfInts _ SimpleVectorOfInts _ h #include #include / / Needed for the exit function using
C
#ifndef SimpleVectorOfIntsSimpleVectorOfIntsh
#define SimpleVectorOfIntsSimpleVectorOfIntsh
#include
#include Needed for the exit function
using namespace std;
class SimpleVectorOfInts
private:
int dynamicArrayPtr; To point to the allocated array
int numberOfElements; Number of elements in the array
int arrayCapacity; capacity of the dynamic array
void memError; Handles memory allocation errors
void subError; Handles subscripts out of range
public:
Default constructor
SimpleVectorOfInts;
Constructor declaration
SimpleVectorOfIntsint;
Copy constructor declaration
SimpleVectorOfIntsconst SimpleVectorOfInts &;
Destructor declaration
~SimpleVectorOfInts;
Accessor to return the array size
int size const
return numberOfElements;
Accesssor to return the capacity of the vector
int capacity const
return arrayCapacity;
Accessor to return a specific element
int getElementAtint position;
Overloaded operator declaration
int &operatorconst int &;
void pushbackint; New pushback member
int popback; New popback member
;
#endif
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
