Quiz Yourself: Classes and OOP II
Assess your understanding of inheritance, polymorphism, casting, and static members in C#.
We'll cover the following...
We'll cover the following...
Technical Quiz
1.
A derived class defines a constructor public Derived(int x) { } without an explicit base call. The base class has both public Base() and public Base(int x). Which base constructor is called?
A.
The compiler infers a call to base(int x) because the parameter types match.
B.
The compiler inserts an implicit call to base(), ignoring the integer parameter.
C.
No base constructor is called since the developer did not explicitly specify a chaining instruction.
D.
A compilation error occurs because the ambiguity between the two base constructors cannot be resolved.
1 / 12