Last active
August 29, 2015 14:23
-
-
Save mlaster/e8111f2f8df0f36f3923 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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