Multiple choice c sharp

How can a child class constructor access parent class constructor?

  1. using base keyword

  2. using super keyword

  3. creating object of parent within child

  4. using this keyword

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In C#, the 'base' keyword is used to call the parent class constructor from a child class constructor. This is commonly done using the constructor initializer syntax (e.g., 'public Child(int x) : base(x)'). The 'super' keyword is used in Java for the same purpose, but this question is clearly C#-focused given the terminology and context. Creating a parent object inside the child class and using 'this' keyword serve different purposes.