我有一个看起来像的代码
subroutine sub1(f)
interface
function f(x)
(description of f)
end function f
end interface
(do something with f)
end subroutine sub1
subroutine sub2(f)
interface
function f(x)
(description of f)
end function f
end interface
(do something with f)
end subroutine sub2
但是,这两个子例程sub1
都sub2
使用相同的接口来实现虚拟功能f
。如何使这两个程序共享相同的界面(例如使用模块)?我必须使用过程指针吗?