<Example Program>
Module vector_with_add Type vector Integer :: X,Y End Type vector Interface Operator(+) Module Procedure add_vector End Interface Contains Type(vector) Function add_vector( i, j ) Result( r ) Type(vector), Intent(In) :: i,j r%x = i%x + j%x r%y = i%y + j%y End Function End Module vector_with_add Program interface_operator_example Use vector_with_add Type(vector) i,j,k I = vector(1,2) J = vector(3,4) k = i + j Print *, k End Program |
|
![]() 4 6 |