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