Is there any difference between a class with destructor and with out destructor.
e.g
class WithOut { }
class With
{
~With(){}
}
Is there any difference between a class with destructor and with out destructor.
e.g
class WithOut { }
class With
{
~With(){}
}
Yes. From the documentation for Destructors:
Empty destructors should not be used. When a class contains a destructor, an entry is created in the Finalize queue. When the destructor is called, the garbage collector is invoked to process the queue. If the destructor is empty, this just causes a needless loss of performance.