Geeks With Blogs
Aaron Feng Agile Software Development (XP), Test Driven Development, .NET, etc.....

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");

    }

}

Posted on Saturday, July 1, 2006 3:25 PM .NET | Back to top


Comments on this post: Feel Smart?

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Aaron Feng | Powered by: GeeksWithBlogs.net