Hi to all members, i have a question about class inheritance and methods using R.oo package: I have the following code and it doesn't work, guess i'm doing smth wrong and there is nothing in the help.
library(R.oo) setConstructorS3("ClassA", function(A=15) { extend(Object(), "ClassA", .size = A ); }) setMethodS3("print", "ClassA", function(this,...) { print(paste('Class A:',this$.size)); }) objA<-ClassA(); objA [1] "Class A: 15" setConstructorS3("ClassB", function(B=15) { extend("ClassA", "ClassB", .size2 = B ); }) setMethodS3("print", "ClassB", function(this,...) { print(paste('Class B:',this$.size2)); }) objB<-ClassB(); objB Error in this$.size2 : $ operator is invalid for atomic vectors -- View this message in context: http://www.nabble.com/Methods-dispatch-and-inheritance-R.oo-tp20339090p20339090.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.