Tuesday, 1 May 2018

Simple console application using Explicit Interfaces

Simple console application using Explicit Interfaces
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplicationSample
{
    interface A
    {
        void Display();
    }
    interface B
    {
        void Display();
    }
    class C : A, B
    {
        void A.Display() //No access Modifier
        {
            Console.WriteLine("A Display");
            Console.ReadLine();
        }
        void B.Display() //No access Modifier
        {
            Console.WriteLine("B Display");
            Console.ReadLine();
        }
    }
    class ExpliciteInterface
    {
        public static void Main()
        {
            C cm = new C();
            //B bm = new B();
            A A1 = (A)cm;
            A1.Display();
            B B1 = (B)cm;
            B1.Display();
        }
    }
}
https://www.youtube.com/channel/UCKLRUr6U5OFeu7FLOpQ-FSw/videos

0 comments

Post a Comment