[Prev][Next][Index][Thread]
simple method dispatch question
-
To: info-dylan@ai.mit.edu
-
Subject: simple method dispatch question
-
From: johncwhi@my-deja.com
-
Date: Fri, 10 Nov 2000 11:15:01 -0500 (EST)
-
Organization: Deja.com - Before you buy.
-
Xref: traf.lcs.mit.edu comp.lang.dylan:12794
This seems to me like it ought to be an easy question to answer, but so
far I can't seem to find anything addressing it in the DRM.
Is it possible to force calling a particular instance of a generic
function-- a super class' instance--when you have an object which
inherits from two different super classes? It's harder for me to
phrase the question correctly than provide some example code, so here
goes:
define class <test> ( <object> )
end class <test>;
define class <test1> (<object> )
end class <test1>;
define class <mixed-test> ( <test>, <test1> )
end class <mixed-test>;
define method print ( <test> )
do-printing-stuff;
end method print;
define method print ( <test1> )
do-more-printing-stuff;
end method print;
define method print ( <mixed-test> )
next-method(); // ?
// how can it call the print for <test> followed by
// the print for <test1>?
end method print;
I've recently been muddling my brain with C++, and you could accomplish
this in C++ with explicit type casting, but I can't think how to do it
Dylan. I vaguely remember an example or two of this kind of thing from
the Dylan Programming book, but I don't have the book handy right now.
TIA
Sent via Deja.com http://www.deja.com/
Before you buy.
Follow-Ups: