A question about technique in trying to use object oriented principles in
Fortran90. It would seem to be a good idea to use a separate module for each
'class', this module containing the type definition and the procedures which
act on that data type. However there is no facility in Fortran90 corresponding
to the C++ 'friend' facility whereby a group of related classes can have access
to the private components of other classes in the group. For this reason I
have found it necessary to group related classes into the same module with the
result that modules become very large. I don't want to declare everything
public since then the benefits of data hiding would be lost. An alternative
would be to provide a full set of public access functions in each class so
every other class in the group could use these, but this could be rather
inefficient resulting in lots of procedure calls (unless a compiler is clever
enough to inline them).
Is there a recommended way of dealing with this situation?
Ray Horne
Cambridge University Library
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|