1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
module procedure_24_mod
implicit none
type :: type1_t
contains
procedure :: printme
end type type1_t
contains
subroutine printme(this)
class(type1_t), intent(in) :: this
end subroutine printme
end module procedure_24_mod
module procedure_24_mod2
implicit none
type :: type2_t
integer :: key
contains
procedure :: printme
end type type2_t
contains
subroutine printme(this, n)
class(type2_t), intent(inout) :: this
integer, intent(in) :: n
this%key = n
end subroutine printme
end module procedure_24_mod2
program procedure_24
use procedure_24_mod
use procedure_24_mod2
implicit none
type(type1_t) :: obj1
type(type2_t) :: obj2
call obj1%printme()
call obj2%printme(422)
if (obj2%key /= 422) error stop
end program procedure_24
|