C# Programming - Constructors - Discussion

Discussion :: Constructors - General Questions (Q.No.5)

5. 

Which of the following statements is correct about constructors?

[A]. If we provide a one-argument constructor then the compiler still provides a zero-argument constructor.
[B]. Static constructors can use optional arguments.
[C]. Overloaded constructors cannot use optional arguments.
[D]. If we do not provide a constructor, then the compiler provides a zero-argument constructor.

Answer: Option D

Explanation:

No answer description available for this question.

Malathisachu said: (Aug 22, 2011)  
If constructor is not used than c# create default constructor while executing the program.

Rajeev said: (Nov 29, 2011)  
If we do not provide a constructor that means all the time default constructor will called which is by default PUBLIC and without parameters. That is why ---

"If we do not provide a constructor, then the compiler provides a zero-argument constructor."

Sank said: (Dec 17, 2013)  
Although main () method is static why then it access all methods of static and non-static?

Jaya said: (Oct 21, 2015)  
If we don't provide constructor, then by default. Default constructor will called without any parameter.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.