Question: 4. (Exception Handling and Functions) Exceptions can be generated when working with functions and they can be caused by not having defined a function target,
4. (Exception Handling and Functions)
Exceptions can be generated when working with functions and they can be caused by not having defined a function target, for example. In these cases an exception of type std::bad_function_call will be thrown. We take an example of a function that takes a double as input.We forget to define the function, then we define it and we define it using a std::string as input. In the first case we get a run-time error and in the second case we get a compiler error:
Answer the following questions:
a) Create and run some code and see how this functionality works.
b) Create some test cases to determine how to use exception handling. Distinguish between compile-time and run-time errors.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
