Hi again,

Here is a very simplified version of a class hierarchy
defined in the Biobase package (Bioconductor). I post
here because this seems to be an S4 related problem:

    setClass("A", representation(name="character"))
    setMethod("initialize", "A", function(.Object) [EMAIL PROTECTED] <- "I'm
    an A"; .Object})

    setClass("Ab", contains="A")
    setMethod("initialize", "Ab", function(.Object) callNextMethod(.Object))

    setClass("Abc", contains="Ab")

    setClass("Abcd", contains = c("Abc"))

Now if I do:

    tmp1 <- new("Abc")
    tmp2 <- new("Abcd")

I get the following warning:

    Warning message:
    Ambiguous method selection for "initialize", target "Abcd" (the
    first of the signatures shown will be used)
        Abc
        Ab
     in: .findInheritedMethods(classes, fdef, mtable)

I don't really understand why .findInheritedMethods is
complaining here...
And if I don't do 'tmp1 <- new("Abc")' before I
do 'tmp2 <- new("Abcd")', then I don't get the warning
anymore!

Does anybody have an explanation for this?


Thanks,
H.

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

Reply via email to