Why does the following exception thrown from the constructor of class A get caught twice, first by the catch within the constructor itself and second time by the catch in th
You are utilizing a feature called function-try-catch. When used in a constructor, it allows catching exceptions in the initialization list (especially useful for catching exceptions in base class constructors) as well as the constructor body. But since the exception is thrown in a constructor, the class is incomplete, so the compiler automatically rethrows any caught exception. that is why you see it caught twice.
Read the following article for more details:
Constructors and Exception in C++