Test 2- Review

Four ADTs

int second_item(stack<int,20>& s)

{

int temp = s.top();

s.pop();

int return_value = s.top();

s.push(temp);

return return_value;

}

template <class T,int M>

class special_stack : public stack<T,M>

{

public:

T second();

};

 

template <class T,int M>

int special_stack<T,M>::second ()

{

T temp = top();

pop();

T return_value = top();

push(temp);

return return_value;

}