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


Please Help Members By Posting Answers For Below Questions

Can a class be static in c++?

561


What is expression parser in c++

1883


What is the difference between global int and static int declaration?

401


What does catch(…) mean?

608


Can a new be used in place of old mallocq? If yes, why?

626






How are virtual functions implemented in c++?

594


Is rust better than c++?

594


What is the difference between a pointer and a link in c ++?

558


What are guid? Why does com need guids?

566


What is copy constructor? Can we make copy constructor private in c++?

587


Which is best c++ or java?

604


Write about the various sections of the executable image?

569


What is runtime polymorphism in c++?

580


What are the manipulators in c++?

545


Can we specify variable field width in a scanf() format string? If possible how?

654