+ 5
Why are contractors and destructors important
4 Answers
+ 5
You neeeeed Constructors to create Objects of a class.
And destructors are helpful - for example you can prevent memory space from beeing blocked.
+ 3
Ans: they have same name as class name, hance they are special.
Working :
Constructor is a special member function whose task is to initialise an object of it's class.
&
Destructor is a special member function whose task is to destroy the object created by constructor.
+ 3
constructors are needed to create the objects of a class...whereas
destructors are helpful in preventing the memory space from being blocked.
+ 1
constructors are useful for initialising varibles. i would also say they result in cleaner easily readable code than when everything is done in the main method