Question
using the following partially defined intArrayList class class intArrayList { public: intArrayList& operator=(const intArrayList &); bool isEmpty()const; bool isFull()const; int listSize()const; int maxListSize()const; void print()const;
using the following partially defined intArrayList class
class intArrayList
{
public:
intArrayList& operator= (const intArrayList &);
bool isEmpty() const;
bool isFull() const;
int listSize() const;
int maxListSize() const;
void print() const;
void clearList();
int seqSearch(const int &item) const;
void insert(const int &insertItem);
void remove(const int &removeItem);
intArrayList(int size = 100);
intArrayList(const intArrayList &otherList);//copy constructor
~intArrayList();
protected:
int *list; //array to hold the list elements
int length; //to store the length of the list
int maxSize; //to store the maximum size of the list
};
a. Implement copy constructor. Explain why copy constructor is necessary?
b. Implement assignment operator overloading. Explain why it is necessary? Discuss its differences with copy constructor.
c. Implement insert function which puts an item which is not in the list. What is the order of the function?
d. Implement search function which queries an item in the list and returns the position. What is the order of the function?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
heres the implementation of the remaining functions of the intArrayList class along with explanations for copy constructor and assignment operator overloading a Copy Constructor Implementation and Exp...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