class Dog {
def color, bark
class Bark {
def pitch, volume
Bark(p, v) {
pitch = p
volume = v
}
}
Dog(c) {
color = c
bark = new Bark(this, "low", "loud")
}
String toString() {
return "The $color dog barks ${bark.pitch} and ${bark.volume}"
}
}
println new Dog("yellow")