19 lines
301 B
Plaintext
19 lines
301 B
Plaintext
|
|
// box field declaration demo (P0)
|
||
|
|
box Counter {
|
||
|
|
count: IntegerBox
|
||
|
|
public { name }
|
||
|
|
|
||
|
|
birth(name) {
|
||
|
|
me.name = name
|
||
|
|
me.count = 0
|
||
|
|
}
|
||
|
|
|
||
|
|
inc() { me.count = me.count + 1 }
|
||
|
|
get() { return me.count }
|
||
|
|
}
|
||
|
|
|
||
|
|
local c = new Counter("nyash")
|
||
|
|
c.inc()
|
||
|
|
local con = new ConsoleBox()
|
||
|
|
con.println(c.get())
|