RosettaCodeData/Task/Call-an-object-method/Go/call-an-object-method-4.go

24 lines
466 B
Go
Raw Permalink Normal View History

2013-04-10 16:57:12 -07:00
procedure main()
bar := foo() # create instance
2017-09-23 10:01:46 +02:00
bar.m2() # call method m2 with self=bar, an implicit first parameter
2013-04-10 16:57:12 -07:00
2017-09-23 10:01:46 +02:00
foo_m1( , "param1", "param2") # equivalent of static class method, first (self) parameter is null
end
2013-04-10 16:57:12 -07:00
class foo(cp1,cp2)
method m1(m1p1,m1p2)
local ml1
static ms1
ml1 := m1p1
# do something
return
end
method m2(m2p1)
# do something else
return
end
initially
L := [cp1]
end