Created
September 13, 2011 19:04
-
-
Save ghais/1214734 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
class C { | |
protected var x = 0; | |
def incr: this.type = { x = x + 1; this } | |
} | |
class D extends C { | |
def decr: this.type = { x = x - 1; this } } | |
Then we can chain calls to the incr and decr method, as in val d = new D; d.incr.decr; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment