- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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,
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, that's the correct way to limit the entities made available by use association.
![](/skins/images/D3C0B914909A6564BBB97F4AD1ED1973/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page