| init | R Documentation |
Function called on oClass instance when it is created. Users create init methods to
customize creation behavior for their Classes. All init methods should return the Instance.
init_next calls the objects next init methods. init_next should only be
used inside if init.
init(x, ...) init_next(x, ...)
x |
environment of class |
... |
named fields inherited by the class instance or passed to methods |
environment of class "Instance"
init_next: Initialize the inherited Class.
Animal <- oClass("Animal")
init.Animal <- function(self, x, y){
self$x <- x
self$y <- y
self
}
turtle <- Animal(5, 10)
turtle$x == 5 # TRUE
turtle$y == 10 # TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.