Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Alessandro Baretta <alex@b...>
Subject: Re: [Caml-list] Protected methods


Dmitry Bely wrote:
> Alessandro Baretta <alex@baretta.com> 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.

Alex

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners