示例#1
0
        static void Main(string[] args)
        {
			MyDerivedClass derived = new MyDerivedClass();
			MyBaseClass mybc = (MyBaseClass)derived;

			Console.WriteLine(derived.MyProperty);
			Console.WriteLine(mybc.MyProperty);
		}
        static void Main(string[] args)
        {
			MyDerivedClass derived = new MyDerivedClass();
			MyBaseClass mybc = (MyBaseClass)derived; // Cast to base class

			derived.Print();	// Call Print from derived portion.
			mybc.Print();		// Call Print from base portion.
		}
示例#3
0
        static void Main(string[] args)
        {
			MyDerivedClass derived = new MyDerivedClass();
			MyBaseClass mybc = (MyBaseClass)derived; // Cast to base class

			derived.Print();
			mybc.Print();
		}