Hi,
I am implementing a class that inherits from two other classes (see the example below). And just wanted to ask whether it is possible to specify which show()
method will be used (A or B) when calling the new show()
method associated with class C.
I am aware that the call to callNextMethod()
results in the call to the first inherited method.
setClass( "A",slots = c(slot1 = "character") ) setMethod( f = "show", signature = "A", definition = function(.Object) { print("Show class A") } ) setClass( "B",slots = c(slot1 = "character") ) setMethod( f = "show", signature = "B", definition = function(.Object) { print("Show class B") } ) setClass( "C",slots = c(slot1 = "character"),contains = c("A","B") ) setMethod( f = "show", signature = "C", definition = function(.Object) { callNextMethod() } ) new("C")
selectMethod()
will do the job, thanks!Michal