Dear all, Recently, there was a question to use the same method for more than one class: https://stat.ethz.ch/pipermail/r-devel/2007-March/044809.html I have a variation of this question: Is it possible to use the same function name, e.g. "myfunction" in both, an S4 baseClass and derivedClass. The method "myfunction" in derivedCalss should extend the functionality defined in baseClass, analogously to C++ methods. If this is possible, does there exist an example? Best regards Christian _._._._._._._._._._._._._._._._ C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a V.i.e.n.n.a A.u.s.t.r.i.a _._._._._._._._._._._._._._._._
cstrato <cstrato at aon.at> writes:> I have a variation of this question: > Is it possible to use the same function name, e.g. "myfunction" in both, > an S4 > baseClass and derivedClass. The method "myfunction" in derivedCalss should > extend the functionality defined in baseClass, analogously to C++ methods. > If this is possible, does there exist an example?The S4 object system is generic function based. Methods are not contained inside classes. You can define a generic 'myfunction' and then define methods for BaseClass and DerivedClass. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org
Dear Seth Thank you, maybe I still do not understand S4 methods. I thought that the purpose of function "callNextMethod()" is to allow some kind of inheritance. In the Bioconuductor packages which are using S4, it is only used for method("initialize") but I thought, that it can be used with every method "mymethod()", is this correct? Best regards Christian