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
| class Robot: MovingObject { | |
| val it = this | |
| val left = "left" | |
| override fun turns(direction: String) { | |
| print("${this.javaClass.simpleName} turned $direction") | |
| } | |
| } | |
| class Car: MovingObject{ | |
| override fun turns(direction: String) { |
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
| class Robot { | |
| val it = this | |
| val left = "left" | |
| infix fun turns(direction: String) { | |
| print("${this.javaClass.simpleName} turned $direction") | |
| } | |
| } | |
| fun operate(block: Robot.(Robot) -> Unit) { | |
| Robot().block(Robot()) |