# NOT RUN {
clown <- oClass("clown")
clown
# 'init' requires a laugh
init.clown <- function(x, laugh, ...){
x$laugh <- laugh
add_fields(x, ...)
return(x)
}
# change formals of clown
clown <- change_formals(clown, from_init = init.clown)
# alternatively,
clown <- change_formals(clown, laugh, ..dots)
# creation
happy_clown <- clown("HAHA")
sad_clown <- clown("ha")
# }
Run the code above in your browser using DataLab