Is it possible to call a parent procedure in a user-defined derived type?
module my_mod implicit none type :: parent_t private integer :: a = 0 contains procedure, public :: print => print_pt end type type, extends(parent_t) :: my_t contains procedure, public :: print => print_mt end type my_t contains subroutine print_pt(this) class(parent_t), intent(in) :: this write(*,'(i0)') this%a end subroutine print_pt subroutine print_mt(this) class(my_t), intent(in) :: this write(*,'(a)') 'My value is' ! How do I call print_pt here? !! call this%print_pt() gives compilation error 6460 end subroutine print_mt end module my_mod
Hopefully the above code is sufficiently explanatory. I have tried a direct call to print_pt but that gives a compiler error
error #6460: This is not a field name that is defined in the encompassing structure. [PRINT_PT]
What is the correct syntax? I'm using Version 188.8.131.52. Thanks.
The method name is print - if you want to invoke the underlying routine directly, that is possible too: