Skip to content

Instantly share code, notes, and snippets.

@hadley
Created June 24, 2011 00:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hadley/1043952 to your computer and use it in GitHub Desktop.
Save hadley/1043952 to your computer and use it in GitHub Desktop.
print.a <- function(x, ...) {
class(x) <- c("a", "c")
NextMethod()
}
print.b <- function(x, ...) cat("b\n")
print.c <- function(x, ...) cat("c\n")
ab <- structure(1:10, class = c("a", "b"))
ab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment