All public and private members of instance 2 will be copied to instance 1, overwriting any of the same names.
Examples
Screamer <- type(function(words){
scream <- function(){
paste0(paste(words,
collapse = " "),
"!!!")
}
})
Whisperer <- type(function(words){
whisper <- function(){
paste0("shhhhhhh.....",
paste(words,
collapse = " "),
"...")
}
})
p1 <- Screamer("I love you")
p1$scream()
#> [1] "I love you!!!"
p2 <- Whisperer("My parents came back")
p2$whisper()
#> [1] "shhhhhhh.....My parents came back..."
p1 <- p1 %>% merge(p2)
# note the the "word" for both methods became that of p2
p1$whisper()
#> [1] "shhhhhhh.....My parents came back..."
p1$scream()
#> [1] "My parents came back!!!"