Skip to content

Instantly share code, notes, and snippets.

@alibahaaa
Created January 22, 2023 16:02
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 alibahaaa/f1ff97d6529c0e5f515fb535f7ee1bdc to your computer and use it in GitHub Desktop.
Save alibahaaa/f1ff97d6529c0e5f515fb535f7ee1bdc to your computer and use it in GitHub Desktop.
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