constructor | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

constructor

can anyone explain to me exactly how a constructor work.?

6th Apr 2017, 12:34 PM
hmangaiha Pachuau
hmangaiha Pachuau - avatar
1 Answer
+ 7
Function without a return type but with the same name as the class, which is invoked when an object is created. Used mainly to initialize variables.
6th Apr 2017, 2:07 PM
Pixie
Pixie - avatar