“OverloadResolutionInheritance” (Solution)

Answer

1
Bar.Quux(),
2
Bar.Quux(params object[])
3
Bar.Quux(), Baz
Copied!

Explanation

A schematic calls tree of the code:
1
Main();
2
new Baz(); // Baz.ctor
3
base.ctor(); // Bar.ctor
4
base.ctor(); // Foo.ctor
5
Quux(); // Bar.Quux() beacuse there is an overload
6
Console.WriteLine("Bar.Quux(), " + name);
7
// name doesn't have value
8
name = "Bar";
9
name = "Baz";
10
Quux();
11
// Bar.Quux(params object[] args) because Bar have a suitable method
12
Console.WriteLine("Bar.Quux(params object[])");
13
((Foo)this).Quux(); // Bar.Quux() beacuse there is an overload
14
Console.WriteLine("Bar.Quux(), " + name); // name == "Baz"
Copied!

Links

Problem
Copy link