Displaying 1 result from an estimated 1 matches for "getbdata".
Did you mean:
get_data
2011 Aug 26
1
R.oo data members / inheritance
..., function(this,...) {
this$.size;
})
setMethodS3("getX", "ClassA", function(this,...) {
this$.x;
})
setConstructorS3("ClassB", function(A,x,bData) {
if(missing(bData))bData = NA;
extend(ClassA(), "ClassB",
.bData = bData
)
})
setMethodS3("getBData", "ClassB", function(this,...) {
this$.bData;
})
Usage:
> b = ClassB(13,100,6)
> b$getSize() # I expected to get 13.
[1] 15
> b$getBData()
[1] 6
> b$getX()
[1] NA # Same thing here. I expected 100.
I corrected it by rewriting the ClassA data membe...