What is constructor. Give example. How does it differ from destructor.
Answers
Answered by
0
constructor means who constructs anything but a destructor means a person who destroys the constructed thing
Answered by
1
Hey guys...✌✌
A destructor does not accept any arguments as its only work is to deallocate the memory of the object. A constructor is called when an object is created. On the other hand, a destructor is called when a program is terminated or the program exit the block in which object is created.
HOPE IT HELPS YOU !!
plz mark me as a brainlist : ) and follow me
A destructor does not accept any arguments as its only work is to deallocate the memory of the object. A constructor is called when an object is created. On the other hand, a destructor is called when a program is terminated or the program exit the block in which object is created.
HOPE IT HELPS YOU !!
plz mark me as a brainlist : ) and follow me
Similar questions