Learn R Programming

bandicoot (version 1.0.0)

use_method: Use a method in an object environment

Description

This function makes a copy of the function, then set the evaluation environment to the container of the object environment.

Usage

use_method(env, fn, container_name = "..method_env..")

Value

A method.

Arguments

env

Environment. Object.

fn

Function. Method.

container_name

Character. Name of the container.

Examples

Run this code

TEST <- new_class(class_name = "TEST")

register_method(TEST, ..str.. = function() "test")

test <- TEST$instantiate(dist = "uniform", prm = list(a = 1, b = 2))
test$..str..()

# Use method `..str..` from BASE class
use_method(test, BASE$..str..)()

Run the code above in your browser using DataLab