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
How do you show the declaration of a virtual constructor?
Can a new be used in place of old mallocq? If yes, why?
Suppose that data is an array of 1000 integers. Write a single function call that will sort the 100 elements data [222] through data [321].
How come you find out if a linked-list is a cycle or not?
Keyword mean in declaration?
What is c++ prototype?
Which software is best for programming?
Is it possible to provide default values while overloading a binary operator?
What is the difference between map and hashmap in c++?
Write a corrected statement in c++ so that the statement will work properly. if (4 < x < 11) y=2*x;
What is the difference between cin.read() and cin.getline()?
We all know that a const variable needs to be initialized at the time of declaration. Then how come the program given below runs properly even when we have not initialized p?
If dog is a friend of boy, and terrier derives from dog, is terrier a friend of boy?
Describe the setting up of my member functions to avoid overriding by the derived class?
What is virtual base class uses?