Foo1 <- new_class("Foo1")
Foo2 <- new_class("Foo2", Foo1)
add <- new_generic("add", c("x", "y"))
method(add, list(Foo2, Foo1)) <- function(x, y) c(2, 1)
method(add, list(Foo1, Foo1)) <- function(x, y) c(1, 1)
method_explain(add, list(Foo2, Foo2))
Run the code above in your browser using DataLab