\HeaderA{getClass}{Get Class Definition}{getClass}
\aliasA{getClassDef}{getClass}{getClassDef}
\keyword{programming}{getClass}
\keyword{classes}{getClass}
\begin{Description}\relax
Get the definition of a class.
\end{Description}
\begin{Usage}
\begin{verbatim}
getClass(Class, .Force = FALSE, where)
getClassDef(Class, where, package)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{Class}] the character-string name of the class.
\item[\code{.Force}] if \code{TRUE}, return \code{NULL} if the class is
undefined; otherwise, an undefined class results in an error.
\item[\code{where}] environment from which to begin the search for the definition; by default,
start at the top-level (global) environment and proceed through
the search list.
\item[\code{package}] the name of the package asserted to hold the
definition.  Supplied instead of \code{where}, with the
distinction that the package need not be currently attached.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
A call to \code{getClass} returns the complete definition of the class
supplied as a string, including all slots, etc. in classes that this
class extends.  A call to \code{getClassDef} returns the definition of
the class from the environment \code{where}, unadorned.  It's usually \code{getClass}
you want.

If you really want to know whether a class is formally
defined, call \code{\LinkA{isClass}{isClass}}.
\end{Details}
\begin{Value}
The object defining the class.  This is an object of class
\code{\LinkA{classRepresentation}{classRepresentation.Rdash.class}}.  However, \emph{do not} deal
with the contents of the object directly unless you are very sure you
know what you're doing.  Even then, it is nearly always better
practice to use functions such as \code{\LinkA{setClass}{setClass}} and
\code{\LinkA{setIs}{setIs}}.  Messing up a class object will cause great
confusion.
\end{Value}
\begin{References}\relax
Chambers, John M. (2008)
\emph{Software for Data Analysis: Programming with R}
Springer.  (For the R version.)

Chambers, John M. (1998)
\emph{Programming with Data}
Springer (For the original S4 version.)
\end{References}
\begin{SeeAlso}\relax
\LinkA{Classes}{Classes},
\code{\LinkA{setClass}{setClass}},
\code{\LinkA{isClass}{isClass}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
getClass("numeric") ## a built in class

cld <- getClass("thisIsAnUndefinedClass", .Force = TRUE)
cld ## a NULL prototype
## If you are really curious:
utils::str(cld)
## Whereas these generate errors:
try(getClass("thisIsAnUndefinedClass"))
try(getClassDef("thisIsAnUndefinedClass"))
\end{ExampleCode}
\end{Examples}

