C++ Programming Tips: Resource Leaks Caused by Constructor Exceptions
If an exception occurs in the constructor of a class, the constructed object will be incomplete, indicating a construction failure. This incomplete object can lead to resource leaks.Assuming we use a “People” class to represent a human, this class should include name, age, facial data, and fingerprint data. We typically write it like this: // … Read more