5 ! Check constructor functionality.
7 ! Contributed by Damian Rouson.
9 module mycomplex_module
14 real :: argument
, modulus
17 module procedure complex_to_mycomplex
, two_reals_to_mycomplex
21 type(mycomplex
) function complex_to_mycomplex(c
)
22 complex, intent(in
) :: c
24 end function complex_to_mycomplex
25 type(mycomplex
) function two_reals_to_mycomplex(x
,y
)
27 real, intent(in
), optional
:: y
29 end function two_reals_to_mycomplex
31 end module mycomplex_module
35 type(mycomplex
) :: a
, b
, c
37 a
= mycomplex(argument
=5.6, modulus
=1.0) ! The structure constructor
38 c
= mycomplex(x
=0.0, y
=1.0) ! A function reference
39 c
= mycomplex(0.0, 1.0) ! A function reference