From: "inv2002" <inv2002@yandex.ru>
To: caml-list@inria.fr
Subject: [Caml-list] Problem with classes or i need help
Date: Thu, 6 Feb 2003 00:40:15 +0300 (MSK) [thread overview]
Message-ID: <3E4184BF.000014.23165@ariel.yandex.ru> (raw)
I don't know correct solution of my problem.
Here my example:
---begin 1.ml---
#!/usr/bin/env ocamltop
class virtual figure () =
object
method virtual to_string: string
end
class triangle () =
object
inherit figure ()
method private to_string = "Triangle"
method m1 = Random.float 5.0
end
class circle () =
object
inherit figure ()
method private to_string = "Circle"
method m2 = Random.int 6
end
class screen () =
object
val mutable figures = []
method add_figure f =
figures <- (f#to_string ) :: figures
end
let main () =
let s1 = new screen () in
s1#add_figure (new circle ());
s1#add_figure (new triangle ())
let () = main ()
--end---
[inv@localhost ~]$ ./1.ml
File "./1.ml", line 22, characters 5-121:
Some type variables are unbound in this type:
class screen :
unit ->
object
val mutable figures : 'a list
method add_figure : < to_string : 'a; .. > -> unit
end
The method add_figure has type < to_string : 'a; .. > -> unit where ..
is unbound
I understand the problem, but i don't know solution, help, please.
--
-------------------
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
next reply other threads:[~2003-02-05 22:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-05 21:40 inv2002 [this message]
2003-02-05 16:31 ` [Caml-list] Ugly fonts in ocamlbrowser/editor Wai-Sun Chia
2003-02-06 6:35 ` Jacques Garrigue
2003-02-06 8:31 ` Wai-Sun Chia
2003-02-06 0:44 ` [Caml-list] Problem with classes or i need help Jacques Garrigue
2003-02-14 15:33 ` inv2002
2003-02-15 7:02 ` Jacques Garrigue
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3E4184BF.000014.23165@ariel.yandex.ru \
--to=inv2002@yandex.ru \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox