Files
linguist/samples/Terra/overloadmethod3.t
2016-01-28 11:22:27 +07:00

18 lines
220 B
Perl

struct A { a : int }
A.methods.foo = terra(self : A)
return 2
end
terra A:foo()
return 1
end
terra doit()
var a = A { 3 }
var pa = &a
return a:foo() + pa:foo()
end
local test = require("test")
test.eq(doit(),4)