Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Object REXX
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Class and Method === The <code>::CLASS</code> [[Object REXX#Instructions|directive]] followed by a class name causes the interpreter to define a new class. After the class name, options such as <code>METACLASS</code>, <code>SUBCLASS</code>, <code>MIXINCLASS</code>, <code>ABSTRACT</code> and <code>INHERIT</code> can be set in order to use OOP features. The <code>::METHOD</code> directive can be used to define a new class method that is associated with the last <code>::CLASS</code> directive. The <code>::ATTRIBUTE</code> directive is used to define an [[Mutator method|accessor method]] that can retrieve or assign an object variable. Using the <code>EXPOSE</code> instruction, an object variable can be directly exposed to a method.<ref name=":2" /><syntaxhighlight lang="oorexx" style="background-color: #ffffff; !important" line="1"> d = .dog~new("Bella") /* create and assign a dog */ d~bark /* send bark message */ say d~name /* output: Bella */ ::class dog /* class directive */ ::attribute name /* attribute directive */ ::method init /* object initiation method */ Expose name /* exposes name of dog */ use arg name /* assigns "Bella" to name */ ::method bark /* method directive */ Expose name say Name "goes woof!" /* output: Bella goes woof! */ </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)