Skip to content

Instantly share code, notes, and snippets.

Created Apr 23, 2014

What would you like to do?
// 簡單的 trait
trait SwimmingAbility {
def swim() {
println "swimming.."
class Goldfish
implements SwimmingAbility // 使用單個 trait
def goldfish = new Goldfish()
goldfish.swim() // 直接可用 trait 的 method
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.