1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
A = nerv.class() function A:_init(x) self.x = x end function A:f() return self.x end function A:g() return self.x + 1 end B = nerv.class(A) function B:f() return self.x * self.x end a = A(3) b = B(3) print(a:f()) print(b:f()) print(b:g())