What would the code:

stack.top().getX() do? I mean, what would it call?

a.) call the getX() method of the result result by stack.top()
b.) call the getX() method of stack, which doesn't exist...