What does the use of constructors? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

What does the use of constructors?

14th May 2020, 7:42 AM
Sinde Jaya Lavanya
2 Answers
+ 24
A constructors for a class is needed so that the compiler automatically initializes an object as soon as it is created . And if the class constructor is defined,is called/invoked whenever a program creates an abject of that class.
14th May 2020, 10:43 AM
RICHA