Is there a way to force the overriding of a deferred type-bound procedure (defined in an abstract parent type) for every child type?
Say, let's have three types T1 (abstract), T2 (extends T1) and T3 (extends T2). Assume that P1 is a deferred procedure declared in T1. Assume that P2 is the deferred implementation of P1 in T2.
Due to inheritance mechanism, T3 also inherits P2, but this is not what is desired in the context of this example. What is desired is a way to force a requirement such that a T3-specific procedure must be provided to override P2.
Is it possible? I tried to declare P2 as PRIVATE, but it was still accessible by T3 (using IVF 17U4).
As far as I can remember, no you cannot *force* another extension type (T3) of a 'concrete' extension (T2) to override an already overridden procedure binding implementation.
And if I recall correctly (I may be wrong about this), an overriding procedure must have the same PUBLIC/PRIVATE visibility attributes as the DEFERRED binding. But now the visibility is with respect to MODULE-level scope only. So if all your type definitions and implementations refer to same MODULE scope, then it shouldn't matter anyway what you do in T2. And if they are in different MODULEs, you won't be able to "game" the rules I think with visibility attributes.
Thanks FortranFan... your answer confirms my suspicions that indeed there is no convenient way to do this, which is unfortunate. I can come up with quite a few scenarios where there is a need for (1) an abstract type which declares a deferred procedure, and (2) each child/grandchild etc. type must be forced to have its own, unique (not inherited!) implementation of that deferred procedure.
Maybe a new procedure attribute (say, UNIQUE) could be used in conjunction with DEFERRED to indicate type-bound procedures forced to comply with such mechanism.
Is T2 intended to be a concrete type? If not, declare another deferred binding in it, that T3 must then implement, with the procedure nominated by the P2 binding in T2 forwarding to that new binding.