See the documentation entries Classes,
  Methods, and GenericFunctions for general discussion of these topics, at a
  fairly technical level.  Links from those pages, and the
  documentation of setClass and setMethod
  cover the main programming tools needed.
  For a complete
  list of functions and classes, use library(help="methods").
Chambers, John M. (1998) Programming with Data Springer (For the original S4 version.)