Re: [R] Methods dispatch and inheritance R.oo

2008-11-06 Thread Henrik Bengtsson
Hi, On Thu, Nov 6, 2008 at 2:12 AM, Yuri Volchik <[EMAIL PROTECTED]> wrote: > > Thanks for reply Henrik, seems obvious now. > Can child class (B) access argument of the parent class, i.e. can i rewrite > definition of the class B as > > setConstructorS3("ClassB", function() { > extend(ClassA(), "

Re: [R] Methods dispatch and inheritance R.oo

2008-11-06 Thread Yuri Volchik
Thanks for reply Henrik, seems obvious now. Can child class (B) access argument of the parent class, i.e. can i rewrite definition of the class B as setConstructorS3("ClassB", function() { extend(ClassA(), "ClassB", .size2 = A ); }) it didn't work for me, so guess i'm doing smth wrong an

Re: [R] Methods dispatch and inheritance R.oo

2008-11-05 Thread Henrik Bengtsson
Hi, if you instead do: setConstructorS3("ClassB", function(B=15) { extend(ClassA(), "ClassB", .size2 = B ); }) then you'll get: > objB <- ClassB(); > objB [1] "Class B: 15" What was wrong with your setup? What you ended up doing was to "extend" an object of class 'character' (with val

[R] Methods dispatch and inheritance R.oo

2008-11-05 Thread Yuri Volchik
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", .s