.BG
.FN UseMethod
.FN NextMethod
.FN Method
.FN RestoreClass
.TL
Methods invoked from S functions
.CS
UseMethod(x)
NextMethod(x)
Method(x)
.PP
These functions implement class-dependent methods in S.
A method is a function `abc.def' is a method in S for function
`abc' and object class `def'.
If function `abc' evaluates a call to `UseMethod' and a suitable
method function is found,
then the
.I body
of the method function is then evaluated in the frame of the current
call to `abc', and the value of that body is then immediately
returned as the value of `abc'.
Note that no repeated argument  matching takes place; arguments in
the definition of `abc.def' are irrelevant and ignored as far as its
use as a method is concerned.
Before the method is invoked, the class attribute `x' is adjusted to
be the appropriate inheritance class corresponding to the method.
If there is no inheriting class, `x' is given class `"default"'.
The original class of `x' is the value of `RestoreClass', called from
within the method.
Therefore
.Cs
class(x) <- RestoreClass(x)
.Ce
restores `x' to it's original form.  Beware, however, that doing this
and then re-invoking the original function sets up a potentially
infinite recursion.
.PP
The function `NextMethod' when called withing  the method, determines
the next inherited method for this function and evaluates it, returning
the value to the calling method.
If there is no inheriting method, the original function is used as
a method.
Calling  `NextMethod'
is the usual way to define a new method that elaborates on what
would be done by an inherited method for the same function.
.PP
The function `Method' returns a character string contining
the name of the method.
If there is no method `NULL' is returned.
.AG x
If provided, the object in the current frame that will determine
what method to use.
By default, the first argument to the original (generic) function
determines the method.
.RT
~Describe the value returned
.EX
.Si "# How function print uses methods
.Si print
function(x, digits, quote = T, prefix = "")
{
    UseMethod()
    if(!missing(digits)) {
      ...
.KW Classes
.KW Language
.WR
