“OverloadResolutionOverride” (Problem)
What will the following code display?
1
class Foo
2
{
3
public virtual void Quux(int a)
4
{
5
Console.WriteLine("Foo.Quux(int)");
6
}
7
}
8
class Bar : Foo
9
{
10
public override void Quux(int a)
11
{
12
Console.WriteLine("Bar.Quux(int)");
13
}
14
public void Quux(object a)
15
{
16
Console.WriteLine("Bar.Quux(object)");
17
}
18
}
19
class Baz : Bar
20
{
21
public override void Quux(int a)
22
{
23
Console.WriteLine("Baz.Quux(int)");
24
}
25
public void Quux<T>(params T[] a)
26
{
27
Console.WriteLine("Baz.Quux(params T[])");
28
}
29
}
30
void Main()
31
{
32
new Bar().Quux(42);
33
new Baz().Quux(42);
34
}
Copied!
Solution
Copy link