use_method {bandicoot}R Documentation

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

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

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


[Package bandicoot version 1.0.0 Index]