Hi the list,

I try to use callNextMethod in a setteur ([<-) but it does not work. 
Any raison ?
Any other option ?

--- 8< ------------------
### Class B0 ###
setClass("B0" , representation(b0 = "numeric"))
setReplaceMethod("[","B0",function(x,i,j,value){x@b0 <- -value})

a <- new("B0")
a@b0 <- 3
a
a["b0"] <- 3
a


### Class B1 ###
setClass("B1", representation(b1 = "character"), contains = "B0")
setReplaceMethod("[","B1",function(x,i,j,value){
  value <- value*2
  callNextMethod()
})

b <- new("B1")
try(b["b0"] <- 5)
--- 8< ------------------

Christophe

--
View this message in context: 
http://r.789695.n4.nabble.com/callNextMethod-in-a-function-does-not-work-tp4177669p4177669.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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