extend.Object {R.oo}R Documentation

Extends another class

Description

Simply speaking this method "extends another class". What is actually happening is that it creates an instance of class name ...className, by taking another Object instance and add ...className to the class list and also add all the named values in ... as fields to the new instance.

The method should be used by the constructor of a class and nowhere else.

Usage

## S3 method for class 'Object':
extend(this, ...className, ...)

Arguments

...className The name of new class.
... Named values representing the fields of the new instance.

Details

The reason for the strange name of argument "...className" is that if one tries to set a field with a name that is a prefix of the name of this arguments and one at the same time does not specify the name of this argument one would run into strange errors. For instance, try extend(Object(), "MyClass", ...c=0).

Value

Returns an Object of class className.

Author(s)

Henrik Bengtsson http://www.braju.com/R/

See Also

For more information see Object.

Examples

## Not run: For a complete example see help(Object).

[Package R.oo version 1.0 Index]