28 lines
520 B
Plaintext
28 lines
520 B
Plaintext
enum NAME, METHOD
|
|
|
|
procedure me_t()
|
|
puts(1,"I is a T\n")
|
|
end procedure
|
|
constant r_t = routine_id("me_t")
|
|
|
|
procedure me_s()
|
|
puts(1,"I is an S\n")
|
|
end procedure
|
|
constant r_s = routine_id("me_s")
|
|
|
|
type T(object o)
|
|
-- as o[METHOD] can be overidden, don't verify it!
|
|
return sequence(o) and length(o)=2 and string(o[NAME]) and integer(o[METHOD])
|
|
end type
|
|
|
|
type S(T t)
|
|
return t[METHOD] = r_s
|
|
end type
|
|
|
|
S this = {"S",r_s}
|
|
T that = {"T",r_t}
|
|
|
|
call_proc(that[METHOD],{})
|
|
that = this
|
|
call_proc(that[METHOD],{})
|