- 读栈顶元素
template <class T>
T Stack<T>::GetTop()
{if(IsEmpty());exit(1);
return top->data
}
本文介绍了一个模板栈类中的 GetTop() 方法实现,该方法用于返回栈顶元素。若栈为空,则程序将退出。
template <class T>
T Stack<T>::GetTop()
{if(IsEmpty());exit(1);
return top->data
}
1526

被折叠的 条评论
为什么被折叠?