Created
October 26, 2018 23:18
-
-
Save bendmorris/17b27f614201c186a71a2b4c692fd29b to your computer and use it in GitHub Desktop.
Kit: trait method forwarding
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
trait MyTrait { | |
public function doSomething(): Void; | |
} | |
abstract MyType: Int { | |
rules { | |
($this.doSomething) => $this.MyTrait.doSomething; | |
} | |
} | |
implement MyTrait for MyType { | |
public function doSomething() { | |
printf("hi!\n"); | |
} | |
} | |
function main() { | |
var x: MyType = 1; | |
x.doSomething(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment