static void Main(string[] args) { MyClass mclass = new MyClass(); IA IAClass = (IA)mclass; IB IBClass = (IB)mclass; string test1 = IAClass.Foo(); string test33 = IBClass.Foo(); int inttest = IAClass.Foo2(); string test2 = IBClass.Foo2(); Console.ReadKey(); }
static void Main(string[] args) { //implicitly implemented methods can be invoked implicitly and explicitly //implicit Sample sample = new Sample(); //sample.Foo(); //sample.Foo1(); sample.Foo2(); sample.ClsMethod(); //explicitly implemented methods can be invoked ONLY explicitly //explicit invocation IA ia = sample; ia.Foo1(); ia.Foo(); IB ib = sample; ib.Foo(); ib.Foo2(); }