Answer: These are nothing but class-only methods which will execute before the garbage collector reclaims the memory for an unreferenced object. To implement finalizer, you have prefix the symbol(~) before the name of the class.
Syntax:
class Sample
{
~Sample()
{
…….
…….
}
}
Asked In: Many Interviews |
Alert Moderator