Object-Oriented Programming with S3 and R6 in R
Richie Cotton
Data Evangelist at DataCamp
microwave_oven_factory <- R6Class( "MicrowaveOven", private = list( power_rating_watts = 800,
door_is_open = FALSE
),
public = list(
open_door = function() {
private$door_is_open <- TRUE
}
)
)
private$
accesses private elements
self$
accesses public elements
private
listpublic
listprivate$
to access private elements...
and self$
to access public elementsObject-Oriented Programming with S3 and R6 in R