Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* constructors for objects in ocaml
@ 1996-07-23 15:12 Hendrik Tews
  0 siblings, 0 replies; only message in thread
From: Hendrik Tews @ 1996-07-23 15:12 UTC (permalink / raw)
  To: caml-list


Hi everybody,

it is possible to define something like a constructor in ocaml,
ie to add an expression to a class which is evaluated every time
an object is created?

I tried something like

class top arg as self =
  method create x = let _ = print_x
                    in x
  val x = self#create arg
end;;

but got an error saying, that self is unbound.

Bye,

Hendrik Tews





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-07-23 19:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-23 15:12 constructors for objects in ocaml Hendrik Tews

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox