Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

* @description Assignment 07 part 01, practice with operator overloading. * In this first part of assignment, you need to define a ListType class *

* @description Assignment 07 part 01, practice with operator overloading. * In this first part of assignment, you need to define a ListType class * and overload the indicated operators. This version of your class * will only support list of int values. You will turn this into a * class template in part 2 of the assignment. */ #include #include using namespace std;

#ifndef _LISTTYPE_H_ #define _LISTTYPE_H_ /** ListType abstract data type * This list type is "templatized" to support creating concrete lists of * any type of object. This list supports dynamic shrinking and growing * of its size as items are appended and removed from the list. * In addition, several operators are overloaded for convenience of * inserting, accessing and outputting the list to a stream. * * @value id A unique id, each list is assigned its own unique id * upon creation. * @value size The current size (an int) or number of items currently * contained in the list. * @value allocSize The actual amount of memory we currently * have allocated. * @value item A (pointer to an) array of items of our templated * we are holding in our list. */ class ListType { private: // initial allocSize, unless overridden in construction const int ALLOCATION_INCREMENT = 10; static int nextListId; // class variable, assign unique listid int id; int size; int allocSize; int* item;

public: ListType(); // default constructor ListType(int allocSize); // empty constructor ListType(int size, int* items); // construct from array ~ListType(); // class destructor

// getters

// member functions // overloaded operators const ListType& operator=(const ListType& rightList); // I also gave you the copy operator };

// need to include the template implementations here, if/when you templatize //#include "ListType.cpp"

#endif // _LISTTYPE_H_

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions