Basic HTML version of Foils prepared
17 Sept 1996
Foil 14 MODULEs INTERFACES and Overloaded Operators in Fortran90
From
New CPS615HPF and Fortran90 Discussion Sept 17 96 Basic Simulation Track for Computational Science CPS615 --
Fall Semester 96
.
by
Geoffrey C. Fox, Tom Haupt
1
MODULE INTERVAL_ARITHMETIC
TYPE INTERVAL
REAL LOWER, UPPER
END TYPE INTERVAL
INTERFACE OPERATOR(+) define overloaded + operator
MODULE PROCEDURE ADD_INTERVALS
END INTERFACE
2
CONTAINS
FUNCTION ADD_INTERVALS(A,B)
TYPE(INTERVAL) ADD_INTERVALS, A, B
ADD_INTERVALS%LOWER = A%LOWER + B%LOWER
ADD_INTERVALS%UPPER = A%UPPER + B%UPPER
END FUNCTION ADD_INTERVALS(A,B)
3
END MODULE INTERVAL_ARITHMETIC
in Table To:
©
on Tue Oct 7 1997