+2 votes
in Class 12 by kratos

Write any four differences between Constructor and Destructor function with respect to object oriented programming.

1 Answer

+2 votes
by kratos
 
Best answer

| Constructor | Destructor |
| Name of the constructor function is same as that of class | Name of the destructor function is same as that of class preceded by ~ |
| Constructor functions are called automatically at the time of creation of the object | Destructor functions are called automatically when the scope of the object gets over |
| Constructor can be overloaded | Destructor can not be overloaded |
| Constructor is used to initialize the data members of the class | Destructor is used to deinitialize the data members of the class |

...