Skip to content

Instantly share code, notes, and snippets.

@xuwei-k
Created April 16, 2014 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xuwei-k/10896517 to your computer and use it in GitHub Desktop.
Save xuwei-k/10896517 to your computer and use it in GitHub Desktop.
import java.io.File
trait FileNameIsHogeHoge { self: File =>
override def getPath: String = "hogehoge"
}
class MyFile(name: String) extends File(name) with FileNameIsHogeHoge
object Main extends App{
val f = new MyFile("/tmp/file.txt")
assert(f.getPath == "hogehoge")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment