Question: Q4: Parameterized Abstract Data Type (20 points): Examine the class definition of Stack provided on page 481, shown here again for convenience, which defines the
Q4: Parameterized Abstract Data Type (20 points): Examine the class definition of Stack provided on page 481, shown here again for convenience, which defines the stack, by default, to hold up to 100 integers. Write the class definition in C++ that allows users to parameterize the size of the stack to be any value between 1 and 1000, and stack elements could be either integers or float numbers. (Hint refer to Section 11.5.1) #include dost reamb class Stack f private: 77 These members are visible only to other //** members and friends (see Section 11.6.4) int stackPtr int maxLen int topsub public: I1 These members are visible to clients stacko A constructor stackPtr new int (100] maxien-99 topSub--1 StackO (delete 11 stackptrali void push (int number) ( A destructor if (topsubmaxten) cerr
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
