Skip to contents

This function will be called after an instance is built. User could override this function in derived class.

Usage

BASE$..init..(...)

Arguments

...

Ignored by BASE, but user can define their owns.

Value

Return the object itself.

Examples


BASE$..init..
#> function (...) 
#> {
#>     ..mro_current.. <- "BASE"
#>     return(invisible(self))
#> }
#> <environment: 0x125c124e8>

# Inherit from BASE
TEST <- new_class(BASE, class_name = "TEST")

# Override the `..init..` method
register_method(TEST, ..init.. = function(a) {self$x <- a})

# Build a `TEST` instance
test <- TEST$instantiate(a = 2)

test$x
#> [1] 2