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
What is c++ good for?
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 COPY CONSTRUCTOR and what is it used for?
What are c++ files?
What are function prototypes?
Is it possible to get the source code back from binary file?
Can a class be static in c++?
How did c++ get its name?
What is a class template?
Can we declare a base-class destructor as virtual?
In which header file does one find isalpha() a) conio.h b) stdio.h c) ctype.h
What is the copy-and-swap idiom?
Which bit wise operator is suitable for checking whether a particular bit is on or off?
Can a program run without main in c++?
What is c++ hiding?