+ 2

Query about constructors???

what's the purpose of constructor in a function ?

7th Jul 2018, 11:05 AM
Rahul Kumar
Rahul Kumar - avatar
7 Answers
+ 2
is it always necessary to include constructors in the function??? Nitin Khambhala
7th Jul 2018, 1:19 PM
Rahul Kumar
Rahul Kumar - avatar
+ 2
oh yeah my mistake ok anyway thanks Lucky Luke
7th Jul 2018, 1:41 PM
Rahul Kumar
Rahul Kumar - avatar
7th Jul 2018, 11:07 AM
giannismach
giannismach - avatar
+ 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.
7th Jul 2018, 1:18 PM
Nitin Khambhala
Nitin Khambhala - avatar
+ 1
Rahul Kumar constructors are used in classes, not in functions. And yes, it is necessary to use them inside classes.
7th Jul 2018, 1:37 PM
giannismach
giannismach - avatar
+ 1
its not compulsory if u want to initialize something than u can use it
7th Jul 2018, 1:41 PM
Nitin Khambhala
Nitin Khambhala - avatar
+ 1
Rahul Kumar You 're welcome
7th Jul 2018, 1:42 PM
giannismach
giannismach - avatar