Learn R Programming

oops (version 0.2.0)

as.oClass: Convert Object to an oClass Generator

Description

This function takes any named object such as an environment, fully-named list, or an Instance and converts it to an oClass generator function so that instances have access to the fields in the named object. See oClass for details about the arguments and functionality of the oClass generator.

Usage

as.oClass(
  x,
  name = NULL,
  inherit = NULL,
  portable = FALSE,
  hash = FALSE,
  formals = NULL,
  deep = TRUE,
  ...
)

Arguments

x

object to be cloned and converted

name

character string describing the name of the class

inherit

oClass used as the parent.env for the generated instances

portable

logical indicating whether all inherited values should be copied into each instance

hash

logical indicating whether instances should use hashing, see new.env

formals

list containing the formal arguments for the resulting generator function. These are passed to the init function when a new instance is created.

deep

logical. Should the object be deep-cloned?

...

named fields inherited by the class instance

Value

a function of class "ClassGenerator" with attributes describing each generated class instance