+ 2
Query about constructors???
what's the purpose of constructor in a function ?
7 Answers
+ 2
is it always necessary to include constructors in the function??? Nitin Khambhala
+ 2
oh yeah my mistake ok anyway thanks Lucky Luke
+ 1
Here are some related lessons:
https://www.sololearn.com/learn/517/?ref=app
https://www.sololearn.com/learn/3319/?ref=app
+ 1
constructor is used when u want initialize somthing when your object is created.
when any class object is created constructor will automatically be called by compiler.
+ 1
Rahul Kumar constructors are used in classes, not in functions. And yes, it is necessary to use them inside classes.
+ 1
its not compulsory if u want to initialize something than u can use it
+ 1
Rahul Kumar You 're welcome