Learn R Programming

oops (version 0.2.0)

change_inherit: Change the Inheritance of an oClass

Description

This function takes twos oClass generator function and alters the first so that it inherits the template and classes of the second. Existing instances will inherit the objects contained in the new parent, but will not gain access to the S3 methods.

Usage

change_inherit(x, parent)

Arguments

x

oClass generator function

parent

oClass generator function from which x inherits

Value

oClass generator function

Examples

Run this code
# NOT RUN {
typist <- oClass("typist")
job    <- oClass("job", hours = 40, pay=15)

typist <- change_inherit(typist, job)
typist$hours
# }

Run the code above in your browser using DataLab