22 lines
283 B
Text
22 lines
283 B
Text
objects := import("objects")
|
|
fmt := import("fmt")
|
|
|
|
new := func(name) {
|
|
ret := objects.new()
|
|
ret.name = name
|
|
|
|
ret.def("bark", func(self, n){
|
|
fmt.print(self.name, ": ")
|
|
for i:=0 ; i<n ; i++ {
|
|
fmt.print("BARK!")
|
|
}
|
|
fmt.println()
|
|
})
|
|
|
|
return ret
|
|
}
|
|
|
|
|
|
export {
|
|
"new": new
|
|
}
|