Вход на сайт
программирование, курсы для детей оффлайн.
1272 просмотров
Перейти к просмотру всей ветки
Отпускник завсегдатай
в ответ alex445 18.02.24 10:21
офигеть, при сталине в .net framework такой херни не было
interface IA
{
void M() { WriteLine("IA.M"); }
}
A class that implements this interface need not implement its concrete method.
C#Copy
class C : IA { } // OK
IA i = new C();
i.M(); // prints "IA.M"
The final override for IA.M
in class C
is the concrete method M
declared in IA
. Note that a class does not inherit members from its interfaces; that is not changed by this feature:
C#Copy
new C().M(); // error: class 'C' does not contain a member 'M'