Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
30
Task/Call-an-object-method/OoRexx/call-an-object-method.rexx
Normal file
30
Task/Call-an-object-method/OoRexx/call-an-object-method.rexx
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
say "pi:" .circle~pi
|
||||
c=.circle~new(1)
|
||||
say "c~area:" c~area
|
||||
Do r=2 To 10
|
||||
c.r=.circle~new(r)
|
||||
End
|
||||
say .circle~instances('') 'circles were created'
|
||||
|
||||
::class circle
|
||||
::method pi class -- a class method
|
||||
return 3.14159265358979323
|
||||
|
||||
::method instances class -- another class method
|
||||
expose in
|
||||
use arg a
|
||||
If datatype(in)<>'NUM' Then in=0
|
||||
If a<>'' Then
|
||||
in+=1
|
||||
Return in
|
||||
|
||||
::method init
|
||||
expose radius
|
||||
use arg radius
|
||||
self~class~instances('x')
|
||||
|
||||
::method area -- an instance method
|
||||
expose radius
|
||||
Say self~class
|
||||
Say self
|
||||
return self~class~pi * radius * radius
|
||||
Loading…
Add table
Add a link
Reference in a new issue