Browse thread
Re: [Caml-list] OO Interface
- #!Fì£é__1³~~ 0=2°
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | #!Fì£é__1³~~ 0=2° <file13@Q...> |
| Subject: | Re: [Caml-list] OO Interface |
the easiest way to do it is to simply assign
initial values to x and y:
# class p (x:int) (y:int) =
object(self)
val x = 0
val y = 0
method pos = (x,y)
end;;
class p : int -> int -> object method pos : int
* int val x : int val y : int end
# let x = new p 5 7;;
val x : p = <obj>
# x#pos;;
- : int * int = 0, 0
hope this helps....
file13
http://www.qlippoth.com/
---- Begin Original Message ----
From: "Warp" <warplayer@free.fr>
Sent: Thu, 17 Jan 2002 21:34:14 +0100
To: "OCaml" <caml-list@inria.fr>
Subject: [Caml-list] OO Interface
If I got a parametrized class like :
class p (x:int) (y:int) =
object(self)
val x = x
val y = y
method pos = (x,y)
rnd
How do I write the correct interface for this
class ? I can't figure out how
to specify the parameters type.
I don't want to, but perhaps I have to use a
Module ?
Thanks
Warp
-------------------
Bug reports: http://caml.inria.fr/bin/caml-
bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-
request@inria.fr Archives: http://caml.inria.fr
---- End Original Message ----
No 'Truth' until Silence!! The 777 Devils mail http://qlippoth.zzn.com
____________________________________________________________
Get your own FREE Web and POP E-mail Service in 14 languages at http://www.zzn.com.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr