English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Setting function in a class
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-07-19 (07:30)
From: Keyan Zahedi <ml@p...>
Subject: Setting function in a class
hi,

i have the following question: i would like to create a class with functions that can be set later. here is an example:

class myclass =
object
val mutable _myfunc = (* a function of type string -> bool)
method set_myfunc f = _myfunc <- f
method my_func f = _myfunc f
;;

of course the code above does not work.

can anyone tell me how to do this?

regards,
keyan