UseMethod(generic, object, ...) NextMethod(generic, object, ...)
In addition, the DETAILS section discusses the manipulation of function frames that occurs.
The function NextMethod when called within the method, determines the next inherited method for this function and evaluates it, returning the value to the calling 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.
By default, the first argument to the generic function determines the relevant class, with the exception of infix operators. For operators, a method is defined if either of the operands defines a class for which a method exists; in the case that both operands define a method, the two classes must be the same.
# How function print uses methods print function(x, ...) UseMethod("print")print.foo function(x, ...) { dd <- if(length(x) > 5) 4 else 12 # use invisible so the value won't be printed again invisible(NextMethod("print", digits = dd)) }