public abstract class ObjectA { }
public class ObjectB : ObjectA {}
public class ObjectC : ObjectA {}
public static void Main()
ObjectA o = new ObjectB();
DoSomething((ObjectB) o);
DoSomething((ObjectC) o);
public static void DoSomething(ObjectB o) {
Console.WriteLine("Object B called");
public static void DoSomething(ObjectC o) {
Console.WriteLine("Object C called");