static void Main() { SecondDerived derived = new SecondDerived(); // Use SecondDerived. MyBaseClass mybc = (MyBaseClass)derived; // Use MyBaseClass. derived.Print(); mybc.Print(); }
static void Main() { MyDerivedClass derived = new MyDerivedClass(); MyBaseClass mybc = (MyBaseClass)derived; derived.Print(); // Call Print from derived portion. mybc.Print(); // Call Print from base portion. }
static void Main() { MyDerivedClass derived = new MyDerivedClass(); MyBaseClass mybc = (MyBaseClass)derived; derived.Print(); mybc.Print(); }
static void Main() { MyDerivedClass derived = new MyDerivedClass(); MyBaseClass mybc = (MyBaseClass)derived; Console.WriteLine(derived.MyProperty); Console.WriteLine(mybc.MyProperty); }