Skip to content

Instantly share code, notes, and snippets.

@mlaster
Last active August 29, 2015 14:23
Show Gist options
  • Save mlaster/e8111f2f8df0f36f3923 to your computer and use it in GitHub Desktop.
Save mlaster/e8111f2f8df0f36f3923 to your computer and use it in GitHub Desktop.
protocol BaseCommandProtocol {
func requestComplete()
}
extension BaseCommandProtocol {
func requestComplete() {
// For subclasser overrides
print("You should override this")
}
}
class BaseCommand: BaseCommandProtocol {
}
class GetAccountSettingsCommand: BaseCommand {
func requestComplete() {
print("This is not called")
}
}
let x: BaseCommandProtocol = GetAccountSettingsCommand()
// How do I make this call the method on GetAccountSettingsCommand instead of the default implementation from the protocol extension?
x.requestComplete()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment