为什么C#这样设计?
据我所知,一个接口只描述行为,并描述一个实现特定行为的接口类的契约义务。
以下是我想到的一个例子:
// These items will be displayed in a list on the screen.public interface IListItem { string ScreenName(); ...}public class Animal: IListItem { // All animals will be called "Animal". public static string ScreenName() { return "Animal"; }....}public class Person: IListItem { private string name; // All persons will be called by their individual names. public string ScreenName() { return name; } .... }相似问题