[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

25.3 Methods

Class methods are defined as tags with formallists in a class routine, and per the typical FreeM object pattern, must take at least one argument, being THIS (representing a reference to the object instance being accessed).

The following class (MYCLASS) has a constructor, a destructor, and a method called MYMETHOD:

%MYCLASS(THIS,INIT) ;
  Q THIS
DESTROY(THIS) ;
  Q
MYMETHOD(THIS) ;
  Q "VALUE"

The dot operator is used to invoke class methods:

DEFAULT.USER> N MYOBJ=$#^%MYCLASS("")
DEFAULT.USER> W MYOBJ.MYMETHOD()
VALUE

This document was generated on May 5, 2025 using texi2html 5.0.