Question: In project 6 , you defined an ADT FrontList, which restricts insertions, removals, and retrievals to the first item in the list. A class definition
In project you defined an ADT FrontList, which restricts insertions, removals, and retrievals to the first item in the list. A class definition for the ADT FrontList is provided below:
template
class FrontList
public:
Sees whether this list is empty.
virtual bool isEmpty const ;
Gets the current number of entries in this list.
virtual int getLength const ;
Inserts an entry into the front of this list
virtual bool insertconst ItemType& newEntry;
Removes the entry at front of this list.
virtual bool remove;
Removes all entries from this list.
virtual void clear;
Gets the entry at the front of this list.
virtual ItemType getEntry const ;
Replaces the entry at front of this list.
virtual void setEntryItemType& newEntry;
private:
data members here
;
Question points
Define the ADT stack as a derived class from the ADT FrontList using private inheritance AsA relationship Which of the following answers is the correct class definition?
Question options:
a
template
class StackAsA : private FrontList
Public:
StackAsA ;
StackAsA const StackAsA & aStack;
virtual ~ StackAsA ;
bool isEmpty const;
bool pushconst ItemType& newItem;
bool pop;
ItemType peek const throwPrecondViolatedExcep;
;
b
template
class StackAsA
private:
FrontList fList;
Public:
StackAsA ;
StackAsA const StackAsA & aStack;
virtual ~ StackAsA ;
bool isEmpty const;
bool pushconst ItemType& newItem;
bool pop;
ItemType peek const throwPrecondViolatedExcep;
;
c
template
class StackAsA : private FrontList
Private:
Node topPtr;
Public:
StackAsA ;
StackAsA const StackAsA & aStack;
virtual ~StackAsA;
bool isEmpty const;
bool pushconst ItemType& newItem;
bool pop;
ItemType peek const throwPrecondViolatedExcep;
;
d
template
class StackAsA: private FrontList
private:
FrontList fList;
Public:
StackAsA ;
StackAsA const StackAsA & aStack;
virtual ~ StackAsA ;
bool isEmpty const;
bool pushconst ItemType& newItem;
bool pop;
ItemType peek const throwPrecondViolatedExcep;
;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
