Is it possible for the a.doStuff() method to print \"B did stuff\" without editing the A class? If so, how would I do that?
class Program { static void Main
Yes, if you declare doStuff as virtual in A and then override in B.
doStuff
virtual
A
override
B
class A { public virtual void doStuff() { Console.WriteLine("A did stuff"); } } class B : A { public override void doStuff() { Console.WriteLine("B did stuff"); } }