Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have this header file and I need the implementation for several functions: retrieve, merge and isSubset. Thank you. class OrderedList : public List {

I have this header file and I need the implementation for several functions: retrieve, merge and isSubset. Thank you.

class OrderedList : public List

{

public:

static const int DEFAULT_MAX_LIST_SIZE = 10;

// Constructor

OrderedList ( int maxNumber = DEFAULT_MAX_LIST_SIZE );

// Modified (or new) list manipulation operations

virtual void insert ( const DataType &newDataItem ) throw ( logic_error );

virtual void replace ( const DataType &newDataItem ) throw ( logic_error );

bool retrieve ( const KeyType& searchKey, DataType &searchDataItem );

// Output the list structure -- used in testing/debugging

void showStructure () const;

// In-lab operations

void merge ( const OrderedList &other ) throw ( logic_error );

bool isSubset ( const OrderedList &other );

// Inheritance using templates is somewhat ugly in C++. It feels like you

// should be able to access base class member functions and data without the

// scope resolution operator. Sadly, you cannot when using templates.

// See http://www.parashift.com/c++-faq-lite/templates.html#faq-35.19

// Tell compiler to use these base class methods.

using List::remove;

using List::clear;

using List::isEmpty;

using List::isFull;

using List::gotoBeginning;

using List::gotoEnd;

using List::gotoNext;

using List::gotoPrior;

private:

// Locates an element (or where it should be) based on its key

bool binarySearch ( KeyType searchKey, int &index );

{

// Tell compiler to use these base class data members

using List::maxSize;

using List::cursor;

using List::size;

using List::dataItems;

};

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

More Books

Students also viewed these Databases questions