2008-08-20から1日間の記事一覧

可変引数の不思議(C#版)

C#

C#でも全く同じなんだな。 interface IHoge { void Hoge(params string[] args); void Piyo(string[] args); } class Hoge : IHoge { void Hoge(string[] args) {} void Piyo(params string[] args) {} } Hoge h1 = new Hoge(); // これはコンパイルエラー /…

可変引数の不思議

可変引数は基本的には配列だけど、 interface Hoge { void hoge(String[] args); void piyo(String...args); } class HogeImpl implements Hoge { public void hoge(String...args) {} public void piyo(String[] args) {} } こんな感じのことが可能らしい。…