How constructor is useful for setting initial values for certain member variables? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How constructor is useful for setting initial values for certain member variables?

25th Sep 2020, 9:01 AM
Atharva Yadav 10th A
Atharva Yadav 10th A - avatar
2 Answers
+ 9
Constructors are called everytime when a new object is created . passing arguments you can initialize property in class.
25th Sep 2020, 9:38 AM
TOLUENE
TOLUENE - avatar
0
25th Sep 2020, 9:42 AM
Ipang