using System.IO; using System; abstract class A { public void Testme(A other) { Console.WriteLine("value from this: " + Value() + " value from other: " + other.Value()); } protected abstract string Value(); } class B : A { protected override string Value() { return "B class"; } } class C : A { protected override string Value() { return "C class"; } } class Program { static void Main() { B b = new B(); C c = new C(); b.Testme(c); } } // value from this: B class value from other: C class