You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a non-portable object with inheritance is cloned, methods that are inherited (and not overridden) do not get the new object's environment. Originally from #212.
library(R6)
A<- R6Class("A",
portable=F,
public=list(
getx=function() x,
getx2=function() x,
x=1
)
)
B<- R6Class("B",
portable=F,
inherit=A,
public=list(
# Override getx2, but not getxgetx2=function() x
)
)
b<-B$new()
bc<-b$clone()
b$x<-10# Both of these return 10, which is correctb$getx()
#> [1] 10b$getx2()
#> [1] 10# Returns 10, which is incorrect!bc$getx()
#> [1] 10# Returns 1, which is correctbc$getx2()
#> [1] 1
The text was updated successfully, but these errors were encountered:
When a non-portable object with inheritance is cloned, methods that are inherited (and not overridden) do not get the new object's environment. Originally from #212.
The text was updated successfully, but these errors were encountered: