using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace IHogeをリストに突っ込む___ { interface IHoge { void Say(); } class A:IHoge{ protected T Val = default(T); public void Say() { Console.WriteLine("I was... I am A!!"); } } class B:IHoge{ protected T Val = default(T); public void Say() { Console.WriteLine("My Sword... I Remenber B."); } } class Program { static void Main(string[] args) { List LIH = new List(); LIH.Add(new A()); LIH.Add(new A()); LIH.Add(new B()); foreach (var o in LIH) { o.Say(); } return; } } }