can someone explain what arw constructors and what is its use | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can someone explain what arw constructors and what is its use

1st Jul 2017, 3:26 AM
‎ ‏‏‎Anonymous Guy
3 Answers
+ 4
A constructor is kind of like a function that is called when the object of that class is created. It's similar to a destructor which is called when an object is destroyed.
1st Jul 2017, 3:30 AM
Jordan Chapman
Jordan Chapman - avatar
+ 6
It is usually used to initialize the classes variables with a value
1st Jul 2017, 4:26 AM
jay
jay - avatar
0
what is it's use
1st Jul 2017, 3:34 AM
‎ ‏‏‎Anonymous Guy