Use RAII (Resource Acquisition Is Initialization) Exception specification: A way of indicating which exceptions a function may throw. It is used to indicate that a function may throw an exception and to specify which types of exceptions it may throw.