Question: Developing And Testing A Stack Template Write a template, Stack.h , to implement a LIFO stack. Here is the specification for its public interface: class
Developing And Testing A Stack Template
Write a template, Stack.h to implement a LIFO stack. Here is the specification for its public interface:
class Stack
Stack; may have a defaulted parameter
Stackconst Stack&; copy constructor
~Stack;
Stack& operatorconst Stack&;
void pushconst V&;
const V& peek;
void pop;
int size const;
bool empty const;
void clear;
;
If you use dynamic memory and you surely will! be sure to include the three memory management functions as public members, too. You may implement your Stack as arrayed or as linked your choice.
Test on one primitive data type, int, double or char, and the string object
Fully test your template in a test driver CPP named Stack.TestDriver.cpp
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
