Created
January 22, 2023 16:02
-
-
Save alibahaaa/f1ff97d6529c0e5f515fb535f7ee1bdc 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
interface Implementor { | |
fun operationImplementation() | |
} | |
class ConcreteImplementorA : Implementor { | |
override fun operationImplementation() { | |
// implementation | |
} | |
} | |
class ConcreteImplementorB : Implementor { | |
override fun operationImplementation() { | |
// implementation | |
} | |
} | |
abstract class Abstraction(protected var implementor: Implementor) { | |
abstract fun operation() | |
} | |
class RefinedAbstractionA(implementor: Implementor) : Abstraction(implementor) { | |
override fun operation() { | |
implementor.operationImplementation() | |
} | |
} | |
class RefinedAbstractionB(implementor: Implementor) : Abstraction(implementor) { | |
override fun operation() { | |
implementor.operationImplementation() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment