caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Objects and Initializers
@ 2003-04-04  5:35 Seth Kurtzberg
  2003-04-04  5:59 ` SooHyoung Oh
  0 siblings, 1 reply; 2+ messages in thread
From: Seth Kurtzberg @ 2003-04-04  5:35 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Objects and Initializers
  2003-04-04  5:35 [Caml-list] Objects and Initializers Seth Kurtzberg
@ 2003-04-04  5:59 ` SooHyoung Oh
  0 siblings, 0 replies; 2+ messages in thread
From: SooHyoung Oh @ 2003-04-04  5:59 UTC (permalink / raw)
  To: Seth Kurtzberg, caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-04-04  5:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-04  5:35 [Caml-list] Objects and Initializers Seth Kurtzberg
2003-04-04  5:59 ` SooHyoung Oh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).