コード例 #1
0
            public override string ship(Shipper shipper)
            {
                string rval = base.ship(shipper);

                return(rval + "**MARK RETURN RECEIPT REQUESTED**");
            }
コード例 #2
0
            public override string ship(Shipper shipper)
            {
                string rval = base.ship(shipper);

                return(rval + "**MARK FRAGILE**");
            }
コード例 #3
0
            public override string ship(Shipper shipper)
            {
                string rval = base.ship(shipper);

                return(rval + "**MARK DO NOT LEAVE IF ADDRESS NOT AT HOME**");
            }
コード例 #4
0
 protected override double calculateCost(double weight, Shipper shipper)
 {
     return(0);
 }
コード例 #5
0
 public override string ship(Shipper shipper)
 {
     return(nextShipment.ship(shipper));
 }
コード例 #6
0
 protected override double calculateCost(double weight, Shipper shipper)
 {
     return(shipper.GetPackageCost(weight) + shipper.GetOversizeSurcharge(weight));
 }
コード例 #7
0
 protected override double calculateCost(double weight, Shipper shipper)
 {
     return(shipper.GetPackageCost(weight));            //have different method for different sizes rather than passing in parameters
     //open for extension not modification
 }
コード例 #8
0
 // protected = only available in this class and derived classes
 //virtual = can be overridden
 //the derived Shipper class can be passed to an instance of the Shipper class as it implements all of its properties.
 protected abstract double calculateCost(double weight, Shipper shipper);         //delegating implementation to sub classes