Created
February 3, 2019 16:14
-
-
Save aainaj/3db5811be1f839af503f8e3d407742d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product { | |
func calculateShippingCost() -> BaseShippingStrategy { | |
return BaseShippingStrategy() | |
} | |
} | |
class PhoneProduct: Product { | |
// An instance of a subclass can always be substituted for an instance of its superclass. | |
override func calculateShippingCost() -> WorldShippingStrategy { | |
return WorldShippingStrategy() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment