Skip to content

Instantly share code, notes, and snippets.

@AliciaSchep
Created November 30, 2017 05:04
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 AliciaSchep/123eb2555129b7f5aadf69ec7ae215c6 to your computer and use it in GitHub Desktop.
Save AliciaSchep/123eb2555129b7f5aadf69ec7ae215c6 to your computer and use it in GitHub Desktop.
setClass("DummyClass",
slots = c(y = "numeric"))
setClass("SpecialClass",
slots = c(x = "numeric"),
contains = c("DummyClass"))
setClass("SpecialList",
prototype = list(elementType = "DummyClass"),
contains = c("SimpleList"))
x <- new("SpecialList")
new_special <- new("SpecialClass", y = 3, x = 2)
x[["a"]] <- new_special
print(new_special)
print(x[["a"]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment