Home > Back-end >  Stack T&top and const T&top const ()
Stack T&top and const T&top const ()

Time:09-26

 T& Top () {
If (stack_size==0) {
Throw 1;
}
The return data [stack_size - 1);
}
Const T& Top () const {
If (stack_size==0) {
Throw 1;
}
The return data [stack_size - 1);
}

In my main function,
 for (int I=5; I & gt;=0; I -) {
Try {
Cout & lt; . The top () & lt; }
The catch (int int_e) {
Cout & lt; <"Get top failed" & lt; }
Cout & lt; }

This code to perform the top of which the top () () what? Solving!!!!!!

CodePudding user response:

Depends on whether s const
  • Related