Question
c++ Declaration of class : #ifndef List_H #define List1_H #include Using namespace std; Class List { friend ostream &operator public: List(int = 5); //default constructor
c++
Declaration of class :
#ifndef List_H
#define List1_H
#include
Using namespace std;
Class List {
friend ostream &operator
public:
List(int = 5); //default constructor with size
List (const List&); //copy constructor
~List(); //destructor
int lengthIs() const; //return the number of elements in the List
bool isFull() const; //returns true if the list is full, false otherwise
bool isThere (int element) const; // returns true if the element
// is present in the list, false otherwise
bool operator==(const List & ) const; // equality operator;
List & operator++( ); //pre-increment
const int& operator[](int index)const;//subscript operator
const List &operator=( const List & ); // assignment operator
virtual void insertItem(int item) = 0;
virtual void deleteItem (int item) = 0;
protected:
int numItems; // current number of items within the list
int maxSize; //max number of elements that can be stored in the list
int *ptr; // pointer to the dynamic array that holds the list elements
};
#endif
You have the declaration of a list of integers, presented below as an inheritance hierarchy Using List as an abstract class, one can derive two subclasses, sorted list (SortedList) and unsorted list (UnsortedList). SortedList stores integers in sorted order whereas UnSorted list stores integers the way user enters them. List SortedList UnSortedList The declaration of the class List is given below #iindef List,H #define List 1H #include-qOstream> Using namespace std; - Class List friend ostream &operator Using namespace std; - Class List friend ostream &operatorStep 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