1、新建接口类库
public interface ICard { //账户金额 double Money { get; set; } //获取账户信息 string GetCountInfo(); //存钱 void SaveMoney(double money); //取钱 void CheckOutMoney(double money); }
2、新建类库继承接口
public class NHCard : ICard { private double _money = 30.0; public double Money { get { return _money; } set { _money=value; } } public string GetCountInfo() { return "Bank Of NongHang"; } public void SaveMoney(double money) { this.Money += money; } public void CheckOutMoney(double money) { this.Money -= money; } }