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
[Caml-list] Protected methods
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-07-21 (13:07)
From: Alessandro Baretta <alex@b...>
Subject: Re: [Caml-list] Protected methods

Dmitry Bely wrote:
> Alessandro Baretta <> writes:
> But why do you need to call other instance's private/protected
> methods? Maybe you should slightly change your design? Could you roughly
> describe your task?
> - Dmitry Bely

Yes. I have a class whose instances are responsible for 
formatting specific XML trees. Each instance is responsible 
for generating a text box which is decomposed in a header, a 
body, and a footer. While a given object handles directly 
the body of a text box, it delegates the header and the 
footer to two other instances of the same class, in a 
"has-a" relation with the former. This decomposition can be 
done recursively, thereby yielding an object tree or 
hierarchy. There are methods that are only meaningful when 
called by the body object on the header and footer objects. 
Client classes of this text box class are not supposed to 
invoke those methods that are used for data exchange between 
two objects associated by the above "has-a" relation.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: