+ 5

Why are contractors and destructors important

31st Mar 2018, 2:25 PM
Hethal
Hethal - avatar
4 Respostas
+ 5
You neeeeed Constructors to create Objects of a class. And destructors are helpful - for example you can prevent memory space from beeing blocked.
31st Mar 2018, 2:28 PM
D B
D B - avatar
+ 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.
24th Apr 2018, 12:40 PM
Jayesh Patil
Jayesh Patil - avatar
+ 3
constructors are needed to create the objects of a class...whereas destructors are helpful in preventing the memory space from being blocked.
13th Aug 2018, 4:43 PM
Priyasha Das
Priyasha Das - avatar
+ 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
30th Apr 2018, 10:42 PM
Francis
Francis - avatar