static void Main(string[] args)
        {
			MyClass mc = new MyClass(); // Create instance
			mc.PrintOut("jack_kate");	// Call method

			IIfc1 ifc = (IIfc1)mc; // cast the reference to the class obj to the interface type.
			ifc.PrintOut("hello"); // use reference to interface to call member.
		}
Beispiel #2
0
        static void Main(string[] args)
        {
			MyClass mc = new MyClass();	// Create class object.
			mc.PrintOut("Object");		// Call class object implementation method.

			IIfc1 ifc = (IIfc1)mc;		// Cast class object ref to interface ref.
			ifc.PrintOut("Interface");	// Call interface method.
		}
        static void Main(string[] args)
        {
			MyClass mc = new MyClass();
			mc.PrintOut("object");
		}