using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InterfaceUnderstand
{
    interface IPower
    {
        void action();
    }

    interface IBoot
    {
        void action();
    }

    class NoteBook : IPower, IBoot
    {
        void IPower.action()
        {
            Console.WriteLine("NoteBook::IPower.action() 호출.");
        }

        void IBoot.action()
        {
            Console.WriteLine("NoteBook::IBoot.action() 호출.");
        }
    }

class DesktopPC : IPower, IBoot
    {
        void IPower.action()
        {
            Console.WriteLine("DesktopPC::IPower.action() 호출.");
        }

        void IBoot.action()
        {
            Console.WriteLine("DesktopPC::IBoot.action() 호출.");
        }
    }

class Program
{
static void Main(string[] args)
        {
/*NoteBook을 Handling*//*NoteBook을 Handling*//*NoteBook을 Handling*/
/*NoteBook을 Handling*//*NoteBook을 Handling*//*NoteBook을 Handling*/
            NoteBook mc = new NoteBook();
            
            IPower imca = mc;
            imca.action();

            IBoot imcb = mc;
            imcb.action();

/*DesktopPC를 Handling*//*DesktopPC를 Handling*//*DesktopPC를 Handling*/
/*DesktopPC를 Handling*//*DesktopPC를 Handling*//*DesktopPC를 Handling*/
DesktopPC mcc = new DesktopPC();
            
            IPower imcaa = mcc;
            imcaa.action();

            IBoot imcbb = mcc;
            imcbb.action();
        }
}
}

+ Recent posts