От: | gandjustas | http://blog.gandjustas.ru/ | |
Дата: | 06.06.10 20:26 | ||
Оценка: | 5 (1) |
S>interface IFoo
S>{
S> void Foo(int[] v);
S>}
S>interface IFoo2
S> : IFoo // (1)
S>{
S> //void Foo(int[] v); // (2)
S>}
S>class FooImpl : IFoo2
S>{
S> public void Foo(int[] v)
S> {
S> }
S>}
S>class Program
S>{
S> static void Bar(IFoo2 foo, dynamic v)
S> {
S> foo.Foo(v); // (3)
S> // new FooImpl().Foo(v); // (4)
S> }
S> static void Main()
S> {
S> Bar(new FooImpl(), new[] {1, 2, 3});
S> }
S>}
S>
Говорит что ConsoleApp.IFoo2 не содержит метода Foo.S>'ConsoleApp.IFoo' does not contain a definition for 'Foo'
... consider an interface, IFoo, that has a single method. An interface, IBar, which
derives from it, is requiring that any object type that supports IBar also support IFoo. It does not say anything
about which methods IBar itself will have.