JohnBaek
6/28/2017 - 2:25 AM

Program.cs

using System;
using System.Collections.Generic;
using System.Threading;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            List<ISayHello> speakers = new List<ISayHello>();
            ISayHello normalSpeaker  = new NormalSpeaker();
            ISayHello crazySpeaker   = new CrazySpeaker();
            speakers.Add(normalSpeaker);
            speakers.Add(crazySpeaker);

            speakers.ForEach(s => s.SayOutLoud());
            Console.ReadKey();
        }
    }

    public class NormalSpeaker : ISayHello
    {
        public void SayOutLoud()
        {
            Console.WriteLine("Normarl Speaker");
        }
    }

    public class CrazySpeaker : ISayHello
    {
        public void SayOutLoud()
        {
            Console.WriteLine("Fuck!");
        }
    }


    public interface ISayHello
    {
        void SayOutLoud();
    }
}