Why constructor cannot be consider as a member function. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why constructor cannot be consider as a member function.

26th Nov 2017, 7:08 AM
Dheeraj Sharma
Dheeraj Sharma - avatar
2 Answers
+ 5
constructor is called when you initialize the class, while member function called after you initialize the class if not static
26th Nov 2017, 7:10 AM
Momo Belia
Momo Belia - avatar
+ 1
Constructor executes when object is created.We don't need to call constructor to perform its execution.On other hand member method and member variable need to call them. :)
26th Nov 2017, 7:49 AM
Faisal Rahman
Faisal Rahman - avatar