I have a class Details that contains information needed by FirstSet to do some 
calculations then a super class that returns Details and FirstSet.  The problem 
seems to be in FirstSet where I use the function getAnumber(id).  

setClass("Details",
         representation(
           ID = "character",
           Anumber = "numeric"))

setGeneric("Details",
           def = function(object){standardGeneric("Details")})

setMethod("initialize",
          signature(.Object = "Details"),
          function(.Object, ID = "character", Anumber = numeric()){
            .Object@ID = ID
            .Object@Anumber = 2
            return(.Object)
          })

# getter for A number
setGeneric("getAnumber", function(object){standardGeneric("getAnumber")})

setMethod("getAnumber","Details",
          function(object){return(Object@Anumber)})

setClass("FirstSet",
         representation(
           Anothernumber = "numeric"))

setGeneric(
  name = "FirstSet",
  def = function(object){standardGeneric("FirstSet")}
)
setMethod("initialize",
          signature(.Object = "FirstSet"),
          function (.Object, id = "character", multiplier = numeric())
          { x = getAnumber(id)
            y = x * multiplier
            .Object@Anothernumber = y
            return(.Object)
          }
)

setClass("Super", contains = c("Details", "FirstSet"))

setGeneric("Super",
           def = function(object){standardGeneric("Super")})

setMethod("initialize",
          signature(.Object = "Super"),
          function(.Object, id = "character", Anumber = Anumber()){
            Details<- new("Details", ID = id, Anumber = number)
            FirstSet <- new("FirstSet", Anothernumber = Anothernumber)
            Super <- new("Super", Details, FirstSet)
            return(.Object)
          })

______________________________________________
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