コード例 #1
0
        public MainChainOfResponsabilityProgram()
        {
            this.BikeCapacity = new BikeCapacity(1);
            this.CarCapacity = new CarCapacity(5);
            this.BusCapacity = new BusCapacity(40);

            BikeCapacity.SetSuccessor(CarCapacity);
            CarCapacity.SetSuccessor(BusCapacity);
        }
コード例 #2
0
 public void SetSuccessor(VehicleCapacity successor)
 {
     this.Successor = successor;
 }