What is the difference between constructor and destructor in OOP?

Constructor is called automatically , while the object is created. Destructor is called automatically, as block is exited or program terminates. Constructor allows an object to initialize some of its value before, it is used. Destructor allows an object to execute some code at the time of its destruction.

Sizin İçin Seçtik  What is copy constructor explain?

Leave a Reply

Your email address will not be published. Required fields are marked *