Bird
0
0

Which of the following is the correct way to call a parent class constructor using base in C#?

easy📝 Syntax Q12 of 15
C Sharp (C#) - Inheritance
Which of the following is the correct way to call a parent class constructor using base in C#?
Apublic Child() : base() { }
Bpublic Child() base() { }
Cpublic Child() call base() { }
Dpublic Child() : parent() { }
Step-by-Step Solution
Solution:
  1. Step 1: Recall syntax for calling parent constructor

    In C#, to call a parent constructor, use : base() after the child constructor signature.
  2. Step 2: Match correct syntax

    public Child() : base() { } uses public Child() : base() { }, which is the correct syntax.
  3. Final Answer:

    public Child() : base() { } -> Option A
  4. Quick Check:

    Parent constructor call = : base() [OK]
Quick Trick: Use colon and base() after constructor name [OK]
Common Mistakes:
MISTAKES
  • Omitting colon before base()
  • Using base() inside constructor body incorrectly
  • Using wrong keyword like parent()

Want More Practice?

15+ quiz questions · All difficulty levels · Free

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