Under which conditions compiler provide default constructor to an object when no default constructor is defined in the class definition?

Showing Answers 1 - 4 of 4 Answers

Guest

  • Jan 9th, 2007
 

Only if the class has no constants and references ( have to initialized upon creation)

  Was this answer useful?  Yes

MA

  • Feb 8th, 2007
 

also when you create a consturctor with arguments, it has to call defaul no argument consturctor :).

  Was this answer useful?  Yes

Prasad2008

  • Jun 10th, 2008
 

If the class designer has not provided any constructor within the class, but we are trying to create an object of that class without passing any argument , then compiler will provide a default zero argument constructor. But in the same scenario, if we are creating an object and trying to pass argument(s) to the object at the time of its creation, in that case compiler will not provide any  one-argument, two-argument constructors etc. It will throw an error.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions