So, I found a solution: First in the "initialize" method of class C coerce the 
C object into a B object. Then call the next method in the list with the B 
class object. Now, in the "initialize" method of class B the object is a B 
object and the respective "generateSpec" method is called. Then, in the 
"initialize" method of C the returned object from "callNextMethod" has to be 
written to the C class object in .Object. See the code below.

setMethod("initialize", "C", function(.Object, value) {.Object@c <- value; 
object <- as(.Object, "B"); object <- callNextMethod(object, value); 
as(.Object, "B") <- object; .Object <- generateSpec(.Object); return(.Object)})

This setting works. I do not know though, if this setting is the "usual" way 
such things are done in R OOP. Maybe the whole class design is disadvantageous. 
If anyone detects a mistaken design, I am very thankful to learn.

Best

Simon

 
On Aug 3, 2013, at 9:43 PM, Simon Zehnder <simon.zehn...@googlemail.com> wrote:

> setMethod("initialize", "C", function(.Object, value) {.Object@c <- value; 
> .Object <- callNextMethod(.Object, value); .Object <- generateSpec(.Object); 
> 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