Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] does class polymorphism need to be so complicated?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] does class polymorphism need to be so complicated?
On Thu, Aug 21, 2003 at 01:44:23PM +0200, Remi Vanicat wrote:
> Benjamin Geer <ben@socialtools.net> writes:
> > class type virtual printer = object
> >     method virtual print : #printable -> unit
> > end ;;
> >
> > class type virtual talker = object
> >     method virtual talk : #printable -> unit
> > end ;;
> >
> > class my_printer_talker () = object (self : #printer; #talker)
> >      method print obj = (* ... *)
> >      method talk obj = (* ... *)
> > end ;;
> 
> well this work :
> 
> class my_printer_talker () = object (self : 's)
>      constraint 's = #printer
>      constraint 's = #talker
>      method print obj = (* ... *)
>      method talk obj = (* ... *)
> end ;;

Is there a way to add extra methods to my_printer_talker?

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj
Merjis Ltd. http://www.merjis.com/ - all your business data are belong to you.
'There is a joke about American engineers and French engineers. The
American team brings a prototype to the French team. The French team's
response is: "Well, it works fine in practice; but how will it hold up
in theory?"'

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners