I saw an interesting snippet of code last night on Greg's blog. What do you think the output is? Find out if you are right here.
using
System;
class
Base {
public virtual void Foo(string x) {
Console.WriteLine("Base.Foo(string");
}
}
class
Derived : Base {
public override
void Foo(string
x) {
Console.WriteLine("Derived.Foo(string)");
}
public virtual void Foo(object o) {
Console.WriteLine("Derived.Foo(object)");
}
}
class
Test {
static void Main() {
new Derived().Foo("this is a string");
}
}
|