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
Normally, when you try to define public and private members in the same class with colliding names, you get an error.
MyClass<-R6::R6Class(
"MyClass",
public=list(
colliding_method=function() {"A"}
),
private=list(
colliding_method=function() {"B"}
)
)
#> Error in R6::R6Class("MyClass", public = list(colliding_method = function() {: All items in public, private, and active must have unique names.
However, this check can get bypassed when you use inheritance. See example:
This can be a little confusing when using super$ because you don't specify whether you want a public or private method from the superclass. It seems like what happens is that it just gives you back the first one that it finds.
Normally, when you try to define public and private members in the same class with colliding names, you get an error.
However, this check can get bypassed when you use inheritance. See example:
This can be a little confusing when using
super$
because you don't specify whether you want a public or private method from the superclass. It seems like what happens is that it just gives you back the first one that it finds.Collisions between public members and active bindings through inheritance will error out but not until trying to initialize an object.
However, collisions between private members and active bindings are allowed through.
Seeing the same for both CRAN version 2.3.0 and the current GitHub version.
Examples created on 2018-11-11 by the reprex package (v0.2.1)
The text was updated successfully, but these errors were encountered: