With throw() you declare that the function does not throw any exceptions and yet you do throw one.
So you shouldn't be surprised that things don't go according to plan.
you promised NOT throw any exception in p() by write throw(),however,u did throw a exception,so by default,the global method terminate() will be called to terminate the program 'cause you violate your promise^_^.