Browse thread
[Caml-list] Problem with classes or i need help
[
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: | inv2002 <inv2002@y...> |
| Subject: | Re: [Caml-list] Problem with classes or i need help |
>> class virtual figure () =
>> object
>> method virtual to_string: string
>> end
>[...]
>> class screen () =
>> object
>> val mutable figures = []
>> method add_figure f =
>> figures <- (f#to_string ) :: figures
>> 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.
>
>Are you sure you understood ?-)
>There's nothing in your program to tell the compiler that the argument
> method add_figure : 'a. (#figure as 'a) -> unit = fun f ->
> figures <- f#to_string :: figures
>
>Jacques Garrigue
thanks, i'd try (f:figure) but a need inherit.
and now is a second problem:
method add_figure : 'a. (#figure as 'a) -> string -> unit = fun f k ->
Hashtbl.add figures k f#to_string
work correctly, but
method add_figure : string -> 'a. (#figure as 'a) -> unit = fun k f ->
Hashtbl.add figures k f#to_string
return syntax error,
can i define method
add key figure = ...
???
--
óÅÇÏÄÎÑ ÕÄÁÞÎÙÊ ÄÅÎØ, ÞÔÏÂÙ ÚÁ×ÅÓÔÉ ÐÏÞÔÕ ÎÁ ñÎÄÅËÓÅ (http://mail.yandex.ru)
-------------------
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