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

How can you quickly find the number of elements stored in a dynamic array?

580


Explain the static member function.

711


How do you declare A pointer to a function which receives nothing and returns nothing

723


Is it possible for a member function to delete the pointer, named this?

616


What is the type of 'this' pointer? When does it get created?

552






How do we balance an AVL Tree in C++?

643


What is the best way to declare and define global variables?

705


What is linked list in c++?

695


What is a multimap c++?

684


Is it possible to pass an object of the same class in place of object reference to the copy constructor?

572


By using c++ with an example describe linked list?

607


How does atoi function work?

628


What is a friend function in c++?

583


Is it legal in c++ to overload operator++ so that it decrements a value in your class?

613


Can a program run without main function?

623