Skip to content

Instantly share code, notes, and snippets.

@aainaj
Created February 3, 2019 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aainaj/3db5811be1f839af503f8e3d407742d4 to your computer and use it in GitHub Desktop.
Save aainaj/3db5811be1f839af503f8e3d407742d4 to your computer and use it in GitHub Desktop.
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