Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Objects and Initializers
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: SooHyoung Oh <shoh@d...>
Subject: Re: [Caml-list] Objects and Initializers
You can declare a class with argument like this:

    class box i =
    object(self)
        val num = i
        method print = print_int num
    end;;

    let _ =
        let b = new box 7 in
        b # print;
        print_string "\n"

---
SooHyoung Oh
----- Original Message -----
From: "Seth Kurtzberg" <seth@cql.com>
To: <caml-list@inria.fr>
Sent: Friday, April 04, 2003 2:35 PM
Subject: [Caml-list] Objects and Initializers


> Hello, list:
>
> >From the docs it appears that object initializers cannot take arguments.
Is there a way to accomplish the same thing?  I want to assign values to
instance variables without having to make them mutable.
>
> --
> Seth Kurtzberg
> MIS Corp
> 480-661-1849
> seth@cql.com
>
> -------------------
> 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
>

-------------------
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