Version franηaise
Home     About     Download     Resources     Contact us    
Browse thread
self in classes
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Didier Remy <remy@m...>
Subject: Re: self in classes
> Are there any ways to call the  methods of other objects with self as an
> argument ? 
> I mean situation like that: 
> class foo = object (self)
> 	val observers : bar list = []
> 	method register  = 
> 		Array.iter (function o -> o#register self ) observers
> 		....   			^^^^^^^^^^^^^^^^^^

There is a similar example (the subject/observer pattern) in
the advanced tutorial http://caml.inria.fr/ocaml/htmlman/node5.html

-Didier