On 17/10/2013 9:01 AM, Michael Meyer wrote:
Sorry,
if the previous message seems without context.
Indeed, the first message was bounced by filtering rules (triggered by subject
heading than which nothing could be more benign or less liable to suspician).
It was:
Greetings,
I have an S4 class "B" (Base) which defines a function f=f(this="B",...)
Dervided from B we have a derived class D which also defines a function
f=f(this="D",...)
In the definition of D::f we want to call the version B::f and could do this by
simply calling
f(baseClassObject(this),...)
The question is the following:
How do I refer to the base class object from the derived class?
You're asking the wrong question. You should be asking how to call the
method for the inherited class . callNextMethod() is the answer to that
question.
By the way, your use of the syntax D::f and B::f suggests that you're
thinking from a C++ point of view. That's very likely to lead to
frustration: the S4 object system is very different from C++. Methods
don't belong to classes, they belong to generics. There is no such thing
as D::f or B::f, only f methods with different signatures.
Duncan Murdoch
______________________________________________
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.