Skip to contents

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..")

Arguments

env

Environment. Object.

fn

Function. Method.

container_name

Character. Name of the container.

Value

A method.

Examples


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..()
#> [1] "test"

# Use method `..str..` from BASE class
use_method(test, BASE$..str..)()
#> [1] "<TEST object>"