Cpp Defining Method With Exception Handling