##---- typical case ----
getObjectClassKind(new.env())
# [1] NA
myrc <- setRefClass("RC",
fields = list(x = "numeric"),
methods = list(
initialize = function(x = 1) .self$x <- x,
getx = function() x,
inc = function(n = 1) x <<- x + n
)
)
getObjectClassKind(myrc$new())
# [1] RC
myr6 <- R6::R6Class("R6",
public = list(
x = NULL,
initialize = function(x = 1) self$x <- x,
getx = function() self$x,
inc = function(n = 1) self$x <- x + n
)
)
getObjectClassKind(myr6$new())
# [1] R6
Run the code above in your browser using DataLab