Dear UseRs,

A simple class inheritance example:

setClass("test",representation(a="numeric"))
setMethod("initialize","test",
          function(.Object,x,...){
              print("Initialization!!!")
              callNextMethod(.Object,a=x,...)
          })

new("test",x=23)
[1] "Initialization!!!"
An object of class "test"
Slot "a":
[1] 23

setClass("test2",contains="test",representation(b="integer"))
[1] "Initialization!!!"
Error in .nextMethod(.Object, a = x, ...) : argument "x" is missing, with no default


When trying to define a new class "test2" above, "initialize" method for "test" is called (??? looks like a bug to me) and naturally argument "x" is not found. Thus I can not create a subclass for "test". I could not find anything in documentation.
Thanks,
Vitalie.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to