Skip to content

Instantly share code, notes, and snippets.

@hagbarddenstore
Created August 9, 2013 08:53
Show Gist options
  • Save hagbarddenstore/6192157 to your computer and use it in GitHub Desktop.
Save hagbarddenstore/6192157 to your computer and use it in GitHub Desktop.
I'm B!
I'm B!
void Main()
{
var b = new B();
b.PrintName();
((A)b).PrintName();
}
class A
{
public virtual void PrintName()
{
Console.WriteLine("I'm A!");
}
}
class B : A
{
public override void PrintName()
{
Console.WriteLine("I'm B!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment