[Prev][Next][Index][Thread]
Re: simple method dispatch question
On Fri, 10 Nov 2000 16:25:40 +0000, Jason Trenouth <jason@harlequin.co.uk>
wrote:
> On Fri, 10 Nov 2000 11:15:01 -0500 (EST), johncwhi@my-deja.com wrote:
>
> > 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?
>
> Basically no. You have to do through an explicit protocol:
Which could be alternatively expressed as:
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-as ( as == <test>, x :: <test> )
// do stuff
end method print;
define method print ( x :: <test> )
print-as( <test>, x );
end method print;
define method print-as( as == <test1>, x :: <test1> )
// do more printing stuff
end method print;
define method print ( x :: <test1> )
print-as( <test1>, x );
end method print;
define method print ( x :: <mixed-test> )
print-as( <test>, x );
end method print;
__Jason
Follow-Ups:
References: