+ 2

Why should I use constructor, if I can use simple method to set an attribute value?

26th Jun 2016, 12:47 AM
Maxim Velichkin
Maxim Velichkin - avatar
3 Antworten
+ 5
U have to call a method but in the case of a constructor it gets called automatically when you create the object.
29th Jun 2016, 5:42 PM
Utkarsh Barsaiyan
Utkarsh Barsaiyan - avatar
0
@Utkarsh Barsaiyan thank you, now I understand!
29th Jun 2016, 5:47 PM
Maxim Velichkin
Maxim Velichkin - avatar
0
Thanks
20th Jul 2016, 4:10 PM
Kamogelo Michael Ditinti
Kamogelo Michael Ditinti - avatar