Rabu, 09 November 2016

How to generate exceptions in virtual constructors

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 generate exceptions in virtual constructors appeared first on Coding Security.


How to generate exceptions in virtual constructors
read more

Tidak ada komentar:

Posting Komentar