摘要:
就拿数据库访问来讲: class User { private int _id; public int ID { get { return _id; } set { _id = value; } } private string _name; public string Name { get { r 阅读全文
摘要:
双向耦合的代码 public class Secretary { private IList<StockObserver> observers = new List<StockObserver>(); private string action; //增加 public void Attach(St 阅读全文
摘要:
一 多态 里氏替换原则就已经说明了多态的精髓“子类对象可以替换父类对象的位置,而程序的功能不受影响”。 class Person { //定义虚方法以备子类重写,当子类替换父类对象的位置时,可以表现出多态 public virtual void Run() { Console.WriteLine(" 阅读全文