R.oo (version 1.0.3)

DOLLAR.Class: Makes the fields and methods of an Class accessable via the $ and the [[ operator

Description

Makes the fields and methods of an Class accessable via the $ operator. This method is never called explicitly, but through an indirect usage of the $ operator, e.g. obj$name or obj$getValue().
  1. This method will first search for aget()method, e.g. if name has the value"age", agetAge()will be looked for. If such a method exists it will be called with the Class as the first and only argument, e.g.getAge(this). Aget()is only looked for ifis not a private field. A private field is a namebeginningwith a.(period). The rational for this naming convention is to be consistent with howls()works, which will not list such members by default.
  2. If no such method exists, first then, this method will look a field in the Class can has the namename.
  3. If such neither exists, a method with namenamewill be searched for and returned.
  4. If no fields or methods are found at all,NULLis returned.

Usage

"$.Class"(this, name)
  "[[.Class"(this, name)

Arguments

name
The name of the field or method to be accessed.
...
Not used.

Value

  • Returns the value of a field or a method (function). If no such field or method exists, NULL is returned.

See Also

For more information see Class.

Examples

Run this code
For a complete example see help(Class).

Run the code above in your browser using DataLab