Hi Ales, on 2005-03-18T10:57:10+01:00 Ales wrote: > C++ requires "friend" only because it lacks the idea of modularity. > Since all classes are "apart" they need some way to tell each other "I > can use you" > In pascal you simply put them into 1 unit.
But IMCO this is not really a good OOP-like solution. Above all because every class in the unit have access to all sections of a other class, including the private section (at least in Delphi). A real private section is on my wish list since Delphi 1. Sometimes is it not possible or meaninful to put all related classes in 1 unit, e.g. to avoid monster units and split a problem in surveyable parts, although this classes belong together and are managed by a furthermore class. Then you need to publish more methods, as you need for other resp. the actual usage, this softed the information hiding concept. Years ago I read a description of a object oriented pascal dialect, which use a other concept, IIRC called view concept. The developer can declare different views to a class, which only contain the methods, which are needed for a concrete problem. I think such a concept would be the better way. The developer of a class or component don't need to consider, which methods / fields he need to set in the protected part. A developer which derive a class can define, which methods / fields he need and write a view without any hacks or modification of the origin class. wkr Peter. _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel