Encapsulated Object-Oriented Programming
This chapter examines functional methods for encapsulated object-oriented programming (OOP). It outlines the structure and discusses programming with existing classes. The chapter deals with defining classes and with the fields and methods for such classes. Fields and methods are the essence of reference classes as of all object-oriented programming. Encapsulated OOP in R is made possible by creating a class with a set of fields and methods defined for it. Defining reference classes should be done as part of a package for a project that is extending R. The combination of a class name and the associated package uniquely identifies the class. The class will typically use functions and other software from its package. Much of the functionality used was likely to have been called by functions in the specializing packages, and so would have been exported in any case. Various packages provide mechanisms for dealing with larger objects than R can support internally.