[R] From Java to R OOP

Francisco J. Bido bido at mac.com
Mon Mar 25 07:51:21 CET 2013


Hi, I'm new to OOP in R so please forgive the naiveness of some of the questions.  Here are a couple of them.  It would be great if you can contrast to OOP in Java.

1. R's S4 appears to centered around a dispatch mechanism which in my understanding is just a way to implement polymorphism. Now, here's the snag, I thought polymorphism was an aspect of OOP not by itself the definition of OOP.  What am I missing here?  Is any language that implements polymorphism automatically OO? 

2. Can someone provide a simple example of how NextMethod() works?  I read some things about but I can't make any sense out of it.
It's supposed to facilitate inheritance but how?  Why is it needed, what happens if it's ignored? An example would be useful. Is there a Java equivalent of NextMethod()?

Many Thanks!



More information about the R-help mailing list