Advertisement
Guest User

Untitled

a guest
May 4th, 2011
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module Mod
  2.     implicit none
  3.  
  4.         TYPE derivedtype
  5.  
  6.             integer::i
  7.             procedure(procInterface),POINTER,PASS::f=> NULL()
  8.    
  9.         END TYPE derivedtype
  10.  
  11.  
  12.         ABSTRACT INTERFACE
  13.        
  14.             subroutine procInterface(A)
  15.            
  16.                 import derivedtype            
  17.                 class(derivedtype),intent(inout)::A
  18.  
  19.             end subroutine
  20.  
  21.         END INTERFACE
  22.  
  23.     contains
  24.  
  25.    
  26.         subroutine proc1(A)
  27.             implicit none
  28.             type(derivedType),intent(inout)::A
  29.  
  30.                 A%i=999
  31.  
  32.         end subroutine
  33.  
  34. end module Mod
  35.  
  36.  
  37.  
  38. program Test1
  39.  
  40.     use Mod
  41.     implicit none
  42.  
  43.     type(derivedtype)::T
  44.  
  45.     T%i=123
  46.     T%f => proc1
  47.  
  48.     call T%f()
  49.  
  50.     print*,T%i
  51.  
  52. end program
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement