Fortran 2003
- From: Cliff <c.cheesman@xxxxxxxxxxx>
- Date: Fri, 12 Dec 2008 17:28:10 -0800 (PST)
Hi,
I'm trying to use the procedure pointer to create a method for a
derived type. The code is as follows:
module mymod
type :: mytype
integer :: i
procedure(seti_interface), pointer :: seti
end type
interface
subroutine seti_interface(this,i)
import
type(mytype), intent(out) :: this
integer, intent(in) :: i
end subroutine seti_interface
end interface
contains
subroutine seti_interface(this,i)
type(mytype), intent(out) :: this
integer, intent(in) :: i
this%i=i
end subroutine seti_interface
end module mymod
program Test_03
use mymod
implicit none
type(mytype) :: m
call m%seti(5)
end program Test_03
Unfortunately this doesn't compile (complaining about a name conflict
for seti_interface). I'm using Intel Visual Fortran v11.
Any ideas about where I'm going wrong?
Thanks in advance,
Cliff
.
- Follow-Ups:
- Re: Fortran 2003
- From: Damian
- Re: Fortran 2003
- From: Simulate
- Re: Fortran 2003
- From: Richard Maine
- Re: Fortran 2003
- Prev by Date: Re: scope of variable
- Next by Date: Re: scope of variable
- Previous by thread: pointer to a protected variable
- Next by thread: Re: Fortran 2003
- Index(es):
Relevant Pages
|