Skip to content

S4 : declaration of inheritance

3 messages · Oleg Sklyar, Christophe Genolini

#
Hi the list,

There is two way to declare a new object with inheritence : one can do

setMethod("myClass",
  representation("fatherClass",x="numeric")
  ....

or

setMethod("myClass",
  representation(x="numeric"),
  containt="fatherClass"
  ....

Is there any difference ? What is the usal way ?

Christophe
#
setClass("myClass",
   representation(x="numeric"),
   contains="fartherClass")

seems more logical to me in sense of syntax (pay attention to setClass 
instead of setMethod and contains instead of containt), but both work 
apparently.

Oleg
christophe.genolini at free.fr wrote:

  
    
#
Sorry, I make a mistake... I meant :
what the difference between

setClass("myClass",
   representation("fatherClass",x="numeric")
   ....

or

setClass("myClass",
   representation(x="numeric"),
   contains="fatherClass"
   ....