peterwriesnik
Technical User
hi everyone!
i am looking for a simple way to do the following in Fortran 2003 (using ifort 12.0.0):
module mymod
type, abstract :: type_a
logical val
type(type_b), pointer :: myptr
end type
type, abstract :: type_b
logical val
type(type_b), pointer :: myptr
end type
end module
program main
use mymod
type(type_a), target :: obj_1
type(type_b), target :: obj_2
obj_1%myptr => obj_2
obj_1%myptr%val=.TRUE.
end program
i know the code isn't compiling because val isn't a member of myptr. But is there a simple way to link these two objects using pointers? i basically want an access similar to the one i am using (better: wanting to use) in main.
thanks in advance!
i am looking for a simple way to do the following in Fortran 2003 (using ifort 12.0.0):
module mymod
type, abstract :: type_a
logical val
type(type_b), pointer :: myptr
end type
type, abstract :: type_b
logical val
type(type_b), pointer :: myptr
end type
end module
program main
use mymod
type(type_a), target :: obj_1
type(type_b), target :: obj_2
obj_1%myptr => obj_2
obj_1%myptr%val=.TRUE.
end program
i know the code isn't compiling because val isn't a member of myptr. But is there a simple way to link these two objects using pointers? i basically want an access similar to the one i am using (better: wanting to use) in main.
thanks in advance!