| Line 1... |
Line 1... |
| 1 |
% File src/library/base/man/UseMethod.Rd
|
1 |
% File src/library/base/man/UseMethod.Rd
|
| 2 |
% Part of the R package, http://www.R-project.org
|
2 |
% Part of the R package, http://www.R-project.org
|
| 3 |
% Copyright 1995-2010 R Core Team
|
3 |
% Copyright 1995-2010 R Core Team
|
| 4 |
% Distributed under GPL 2 or later
|
4 |
% Distributed under GPL 2 or later
|
| 5 |
|
5 |
|
| - |
|
6 |
\newcommand{\sspace}{\ifelse{latex}{\out{~}}{ }}
|
| - |
|
7 |
|
| 6 |
\name{UseMethod}
|
8 |
\name{UseMethod}
|
| 7 |
\title{Class Methods}
|
9 |
\title{Class Methods}
|
| 8 |
\alias{UseMethod}
|
10 |
\alias{UseMethod}
|
| 9 |
\alias{NextMethod}
|
11 |
\alias{NextMethod}
|
| 10 |
\alias{S3Methods}
|
12 |
\alias{S3Methods}
|
| Line 156... |
Line 158... |
| 156 |
Note that \code{.Class} is set when the generic is called, and is
|
158 |
Note that \code{.Class} is set when the generic is called, and is
|
| 157 |
unchanged if the class of the dispatching argument is changed in a
|
159 |
unchanged if the class of the dispatching argument is changed in a
|
| 158 |
method. It is possible to change the method that \code{NextMethod}
|
160 |
method. It is possible to change the method that \code{NextMethod}
|
| 159 |
would dispatch by manipulating \code{.Class}, but \sQuote{this is not
|
161 |
would dispatch by manipulating \code{.Class}, but \sQuote{this is not
|
| 160 |
recommended unless you understand the inheritance mechanism
|
162 |
recommended unless you understand the inheritance mechanism
|
| 161 |
thoroughly} (Chambers & Hastie, 1992, p. 469).
|
163 |
thoroughly} (Chambers & Hastie, 1992, p.\sspace{}469).
|
| 162 |
}
|
164 |
}
|
| 163 |
\note{
|
165 |
\note{
|
| 164 |
This scheme is called \emph{S3} (S version 3). For new projects,
|
166 |
This scheme is called \emph{S3} (S version 3). For new projects,
|
| 165 |
it is recommended to use the more flexible and robust \emph{S4} scheme
|
167 |
it is recommended to use the more flexible and robust \emph{S4} scheme
|
| 166 |
provided in the \pkg{methods} package.
|
168 |
provided in the \pkg{methods} package.
|