In my fortran program, I put all derived types, in one module. That module also includes the abstract interface, which is used for some procedure pointers in some derived types.
I was wondering, can I only use the abstract interface when use this module, instead of using everything in the module
For example
module A
type :: type1
real(8) :: val_1, val_2
procedure(sub1), nopass,pointer :: val_1_fun=>null(), val_2_fun=>null()
end type
Abstract interface
subroutine sub1(x,y)
real(8), intent(out) :: x
real(8), intent(in) :: y
end subroutine
end interface
program
use module A, only: sub1
end program
I tried the above one and it works. But I cannot find any other examples. So, is it the correct way to do so?
Thanks,
链接已复制
1 回复
