Selasa, 27 Desember 2016

How to handle exceptions in Constructors and Destructors

It is possible that exceptions might raise in a constructor or destructors. If an exception is raised in a constructor, memory might be allocated to some data members and might not be allocated for others. This might lead to memory leakage problem as the program stops and the memory for data members stays alive in the RAM.   Similarly, when an exception is raised in a destructor, memory might not be deallocated which may again lead to memory leakage problem. So, it is better to provide exception handling within the constructor and destructor to avoid such problems. Following program demonstrates

The post How to handle exceptions in Constructors and Destructors appeared first on Coding Security.


How to handle exceptions in Constructors and Destructors
read more

Tidak ada komentar:

Posting Komentar