as a fan of S4 i had a look at this; more definitive
replies are undoubtedly to come

> ## now: B00 mother class to B01 and B02, and again B02 "contains" B01 by 
> setIs:
> setClass("B00", representation(a="numeric"))
> setClass("B01", representation(a="numeric",b="numeric"), contains= "B00")

the direct specification of containment in the next statement
is important for the dispatch process

> setClass("B02", representation(a="numeric",d="numeric"), contains= "B00")

if we omit the containment assertion your expectations are met

setClass("B02", representation(a="numeric",d="numeric"))
setIs("B02","B01",coerce=function(obj){new("B01", [EMAIL PROTECTED], [EMAIL 
PROTECTED])},
       replace=function(obj,value){new("B01", [EMAIL PROTECTED], [EMAIL 
PROTECTED])})

two diagnostic steps that are illuminating are

getClass("B02")  under both approaches (with and without contains="B00"
in definition of B02 class)

and

getMethods("+")  under both approaches

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to