Version française
Home     About     Download     Resources     Contact us    
Browse thread
OO programming
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dirk Thierbach <dthierbach@g...>
Subject: Re: [Caml-list] OO programming
On Mon, Feb 25, 2008 at 09:51:14PM +0100, Tiphaine.Turpin wrote:
> I get the idea. Would the following satisfy your needs (you may place 
> the code and the type in any order) ?
> 
> let _ = object (self)
> 
>  method init n f =
>    let s = make n (f 0) in
>      for i=1 to n-1 do
>        set s i (f i);
>      done;
>      s
> 
>  method virtual init : int -> (int -> char) -> string
> 
> end

Yes, cool. Didn't think of virtual methods. Thanks.

- Dirk