Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: -- (:)
From: Keyan Zahedi <ml@p...>
Subject: Setting function in a class

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 =
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?