Пример #1
0
        static void Main()
        {
            ImplementationClass obj = new ImplementationClass();
            ITestInterface2     i   = obj;//i is a parent refernce created by using a child instance

            obj.Add(1, 2);
            obj.Sub(6, 3);
            i.Add(2, 2);//we can create a refernce and call it through it
            i.Sub(10, 6);
            Console.ReadLine();
        }
        //public  void Sub(int a, int b) // mandatory to write public here
        //{
        //    Console.WriteLine(a - b);
        //}
        static void Main(string[] args)
        {
            ImplementationClass obj = new ImplementationClass();
            //obj.Add(10, 5);
            //obj.Sub(10, 5);
            ITestInterface2 i = obj; // we can create reference of obj

            i.Add(10, 5);
            i.Sub(10, 5);
            Console.Read();
        }
Пример #3
0
        static void Main()
        {
            ImplementationClass obj = new ImplementationClass();

            obj.Add(100, 11);
            obj.Sub(100, 11);

            ITestInterface2 i = obj;

            i.Add(100, 11);
            i.Sub(100, 11);

            Console.ReadKey();
        }