Skip to content

Instantly share code, notes, and snippets.

@aloon aloon/overwrite
Created Apr 7, 2015

Embed
What would you like to do?
Overwrite System class
class StringHelper(str: String) {
def info: String = str.length.toString + " chars"
}
implicit def stringWrapper(string: String) = new StringHelper(string)
println("hello".info)
object String {
def info: String = "This is the String class"
}
println(String.info)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.