Practice mode C#

Which C# keyword calls a constructor of the base class from a derived class constructor?

Correct answer D. base

Explanation

In C#, a derived constructor chains to a base constructor with an initialiser: public Dog(string name) : base(name) { }. The base keyword also calls overridden members, as in base.ToString(). super is the Java keyword. this(...) chains to another constructor of the same class. Without an explicit initialiser, the base class's parameterless constructor is called.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.