why all c++ program must have default constructor?
Answer Posted / sourisengupta
When you create a Object with no arguments, the compiler automatically creates a default constructor internally. But when you use parameterized constructor in your code then you need to provide the default constructor in your code so that the compiler does not throw any errors at compile time.
It also depends on compiler. some compiler also supports this feature. then you do not need to write default constructor in the code.
| Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
Write a program to interchange 2 variables without using the third one.
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?
What is searching?
What are the two main components of c++?
Describe the process of creation and destruction of a derived class object?
Is c++ slower than c?
How do you write a function that can reverse a linked-list?
How is computer programming useful in real life?
What are punctuators in c++?
What does namespace mean in c++?
What are the c++ access specifiers?
What is exception handling? Does c++ support exception handling?
Write some differences between an external iterator and an internal iterator?
How can you quickly find the number of elements stored in a dynamic array? Why is it difficult to store linked list in an array?
Do you know what is overriding?