Is a default constructor needed?

Java doesn’t require a constructor when we create a class. … The compiler automatically provides a public no-argument constructor for any class without constructors. This is called the default constructor. If we do explicitly declare a constructor of any form, then this automatic insertion by the compiler won’t occur.

Read more

Do I need default constructor in C++?

Answer: C++ Empty constructor necessity depends upon class design requirements . We know that C++ class constructor is called when we create an object of a class. If a class is not required to initialize its data member or does not contain data member, there is no need to write empty constructor explicitly.

Read more