static void Main(string[] args) { IDummy d = new Dumb(); d.Print(); d.Print(4); d.Print("Hello"); Console.WriteLine("------------------------------------------------------------------------------------------------------------"); D b = new ClassB(); M1(b); M2(b); M3(b); M4(b); ClassAbstract c = new ClassB(); c.PrintMe(); //GC.Collect(); //GC.WaitForPendingFinalizers(); IFastFood f = new Sandwich(); f.FastFood(); Console.WriteLine("------------------------------------------------------------------------------------------------------------"); Sandwich a = new Sandwich(); a.FastFood(); Console.WriteLine("------------------------------------------------------------------------------------------------------------"); IPlayableInstrument[] orchestra = new IPlayableInstrument[5]; int i = 0; orchestra[i++] = new Wind(); orchestra[i++] = new Percussion(); orchestra[i++] = new Stringed(); orchestra[i++] = new Brass(); orchestra[i++] = new Woodwind(); TuneAll(orchestra); }
static void Tune(IPlayableInstrument i) { i.Play(); }