proto (version 1.0.0)

proto-package: Object-Oriented Programming with the Prototype Model

Description

Object-oriented programming with the prototype model. "proto" facilitates object-oriented programming using an approach that emphasizes objects rather than classes (although it is powerful enough to readily represent classes too).

Arguments

Examples

Run this code

cat("parent\n")
oop <- proto(x = 10, view = function(.) paste("this is a:", .$x))
oop$ls()
oop$view()

cat("override view in parent\n")
ooc1 <- oop$proto(view = function(.) paste("this is a: ***", .$x, "***"))
ooc1$view()

cat("override x in parent\n")
ooc2 <- oop$proto(x = 20)
ooc2$view()

Run the code above in your browser using DataCamp Workspace