我想扩展一个生成器对象,但是关于这个主题的所有 R 帮助文件都是:
请注意,如果想用子类扩展引用类生成器的能力,这应该通过子类化来完成
refGeneratorSlot
,而不是refObjectGenerator
.
好的,但是您实际上是如何做到的呢?所以我试过:
MyGenerator <- setRefClass("MyGenerator",
contains = "refGeneratorSlot",
methods = list(
new = function(...) {
message("Hello, I'm being instantiated now!")
callSuper(...)
}
)
)
但现在呢?我如何将它与使用的类定义结合使用setRefClass()
?