Bird
0
0

Why does C# allow constructor overloading but not multiple constructors with identical parameter lists?

hard🧠 Conceptual Q10 of 15
C Sharp (C#) - Classes and Objects
Why does C# allow constructor overloading but not multiple constructors with identical parameter lists?
ABecause constructors with same parameters cause runtime errors
BBecause constructors must have unique names
CBecause constructors must differ in parameters to avoid ambiguity during object creation
DBecause C# does not support multiple constructors
Step-by-Step Solution
Solution:
  1. Step 1: Understand constructor resolution

    C# uses parameter lists to decide which constructor to call when creating an object.
  2. Step 2: Explain ambiguity prevention

    If two constructors have identical parameters, the compiler cannot decide which to use, causing errors.
  3. Final Answer:

    Constructors must differ in parameters to avoid ambiguity during object creation -> Option C
  4. Quick Check:

    Parameter difference prevents constructor ambiguity [OK]
Quick Trick: Different parameters prevent constructor call confusion [OK]
Common Mistakes:
MISTAKES
  • Thinking constructors need unique names
  • Believing runtime errors occur instead of compile errors
  • Assuming C# disallows multiple constructors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes