Home / Class Definition Reference / Class Definitions / Method Definitions

Class Definition Reference
Method Definitions
Previous section           Next section
InterSystems: The power behind what matters   

Describes the structure of a method definition.
In most cases, a method definition defines the runtime behavior of the method. InterSystems IRIS supports also method generators, which are a special kind of method that generate the code that is used at runtime.
A method definition has the following structure:
/// description 
Method name(formal_spec) As returnclass [ keyword_list ]  
{ implementation }
Or (for a class method):
/// description 
ClassMethod name(formal_spec) As returnclass [ keyword_list ]  
{ implementation }
Or (for a client method):
/// description 
ClientMethod name(formal_spec) As returnclass [ keyword_list ]  
{ implementation }
Parameter Values
For formal_spec and returnclass, you can specify optional parameter values after the class names. If the method is used as an SQL stored procedure, then these parameter values are used to provide additional information to an ODBC or JDBC client. These parameters are ignored in all other cases. For example:
ClassMethod MyProc(data As %String(MAXLEN = 85)) As %Integer [ SQLProc ]
  Quit 22
For another example:
ClassMethod GetName() As %String(MAXLEN=222) [ SQLProc ]
  Quit "Mo"
See Also

Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-05-24 07:30:09