Hi Christophe --
I don't know whether there's a particularly elegant way. This works
setClass("A", representation(x="numeric"))
setClass("B", representation(y="numeric"))
setClass("C", contains=c("A", "B"))
setMethod("show", "A", function(object)
cat("A\n"))
setMethod("show", "B", function(object)
cat("B\n"))
setMethod("show", "C", function(object) {
callGeneric(as(object, "A"))
callGeneric(as(object, "B"))
cat("C\n")
})
> new("C")
A
B
C
but obviously involves the developer in making explicit decisions
about method dispatch when there is multiple inheritance.
Martin
cgenolin at u-paris10.fr writes:
> Hi the list
>
> I define a class A (slot a and b), a class C (slot c and d) and a class
> E that inherit from A and B.
> I define print(A) and print(B). For print(C), I would like to use both
> of them, but I do not see how...
>
> Thanks for your help...
>
> Christophe
>
> ----------------------------------------------------------------
> Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre
>
> ______________________________________________
> R-help at 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.
--
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109
Location: Arnold Building M2 B169
Phone: (206) 667-2793