/// <summary> /// 构造函数. /// </summary> /// <param name="owner"></param> public Account(string owner) { this._owner = owner; // 新账户默认的状态为: 'Silver' this._state = new SilverState(0.0, this); }
// Overloaded constructors public SilverState(State state) : this(state.Balance, state.Account) { }
// Overloaded constructors public GoldState(State state) : this(state.Balance, state.Account) { }
/// <summary> /// 构造函数. /// </summary> /// <param name="state"></param> public RedState(State state) { // 设置 账户余额 与 账户. this.balance = state.Balance; this.account = state.Account; // 初始化 本状态的基本参数. Initialize(); }