Define a class method
- Last Updated: July 12, 2021
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
Like data members, a method has visibility defined so that the method can be called within a class or from outside the class. A method can have zero or more parameters. Regardless of whether a method has parameters, it can return a value.
Notice that a method begins with a method statement and ends with an end method statement.
Here is the simplified syntax for defining a class method:
method [visibility] {<return-type> | void } <method-name>
( [<parameter-use> <parameter> as <type-name> ][,…]):
<body of method>
return [return-value].
end method.
|
Syntax Element |
Description |
|---|---|
|
visibility |
Public, private, or protected. |
|
return-type |
Can be a built-in or user-defined type. If void is specified, the method returns no value. |
|
parameter-use |
Can be one of input, output, or input-output. |
|
parameter |
The name for the parameter. |
|
type-name |
An ABL built-in type or a user-defined type. |
|
body of method |
The ABL code necessary to implement the functionality of the method. If the method specifies a return type, the body of the method must be written to return a value of the return type specified in the definition of the method. |
|
return-value |
If the method returns a value, the value must match the type specified for return-type. |
- METHOD statement in ABL Reference