Skip to content

Instantly share code, notes, and snippets.

@shugo
Created October 15, 2012 23:08
Show Gist options
  • Save shugo/3896233 to your computer and use it in GitHub Desktop.
Save shugo/3896233 to your computer and use it in GitHub Desktop.
Wrong example of proteted
class Node {
def eval(other: Node): Unit = other.protected_method(this)
protected def protected_method(other: Node) = other
}
class NodeFake(node: Node) extends Node {
override def eval(other: Node): Unit = {
println("pre")
println(this == other.protected_method(this))
println("pre")
}
}
new NodeFake(new Node()).eval(new Node())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment