Question: I need c++ code for the given problem with separate code for HasA , IsA , AsA Program correctness for HasA Program correctness for IsA
I need c++ code for the given problem with separate code for HasA , IsA , AsA
Program correctness for HasA | |
Program correctness for IsA | |
Program correctness for AsA |
Problem
Consider an ADT FrontList, which restricts insertions, removals, and retrievals to the first item in the list. These operations can be defined as
bool insert(const ItemType& newEntry);
bool remove();
Itemtype retrieve() const;
Define an abstract class (interface) for the ADT FrontList, and then implement the class FrontList in the following three different ways:
Store the list's entries in an instance of LinkedList
[Hint: This is similar to the class SortedListHasA. Please see the definition,
implementation and its tester of SortedListHasA on D2L.]
Derive the class FrontList from LinkedList using public inheritance.
[Hint: This is similar to the class SortedListIsA. Please see the definition,
implementation and its tester of SortedListIsA on D2L.]
Derive the class FrontList from LinkedList using private inheritance.
[Hint: This is similar to the class SortedListAsA. Please see the definition, implementation and its tester of SortedListAsA on D2L.]
Other requirements
Add default and copy constructors following LinkedList class.
Add a destructor LinkedList class.
Disable the following member functions when using public inheritance because they may cause problems.
bool insert(int newPosition, const ItemType& newEntry);
bool remove(int position);
void replace(int position, const ItemType& newEntry)
throw(PrecondViolatedExcep);
It is noticed thatifremove(position) is disabled in the case of public inheritance, it would cause a problem for clear() to function incorrectly. So you also need to override clear() function so that it can function correctly.
code a tester program (driver) for each of the three different classes for the ADT FrontList by following the programs that test SortedList class on D2L.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
