委托模式/代理模式
This commit is contained in:
parent
7ee387d82e
commit
9fdb631920
7
src/senior/Proxy/Britisher.kt
Normal file
7
src/senior/Proxy/Britisher.kt
Normal file
@ -0,0 +1,7 @@
|
||||
package senior.Proxy
|
||||
|
||||
class Britisher: Translate {
|
||||
override fun say() {
|
||||
println("委托模式")
|
||||
}
|
||||
}
|
||||
5
src/senior/Proxy/Translate.kt
Normal file
5
src/senior/Proxy/Translate.kt
Normal file
@ -0,0 +1,5 @@
|
||||
package senior.Proxy
|
||||
|
||||
interface Translate {
|
||||
fun say()
|
||||
}
|
||||
10
src/senior/Proxy/Translator.kt
Normal file
10
src/senior/Proxy/Translator.kt
Normal file
@ -0,0 +1,10 @@
|
||||
package senior.Proxy
|
||||
|
||||
class Translator : Translate by Britisher() {
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val translator = Translator()
|
||||
translator.say()
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user