why all c++ program must have default constructor?

Answer Posted / rahin99435

The purpose of constructor is to initialize the class members and allocate necessary resources for them; at runtime.So by default C++ compiler is provided with a default constructor which performs the same job at runtime while the object is created.
There is provision of defining more than one constructor by changing the signatures to get objects of different kind.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate between a constructor and a method in C++.

771


What is a block in c++?

781


When to use “const” reference arguments in a function?

804


What is the return value of the insertion operator?

855


What are files in c++?

770


Explain the difference between overloading and overriding?

853


Which is most difficult programming language?

786


Is c++ slower than c?

791


What are literals in C++?

782


What is the first name of c++?

768


What are smart pointers?

1227


What is setiosflags c++?

710


What is endl?

891


Is c++ still in demand?

873


How a new element can be added or pushed in a stack?

785