Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

class in fortran 90/95?

erheiqin
Beginner
585 Views
Ihave two questions here:
(1)is therea class type style as in C++ in fortran, so that I can group some data type variables and functions together?
(2) is there any function pointer in fortran ?
If not, any suggestions on how to do it?
Thanks,
Emmy
0 Kudos
3 Replies
garyscott
Beginner
585 Views

1) Not by name. Some competing products such as from Lahey have class extensions from the Fortran 2003 standard. You might in some cases be able to sove the problem adequatelyusing derived types and modules.

2) Not until Fortran 2003, however some current compilershavesuch extensions.

0 Kudos
Steven_L_Intel1
Employee
585 Views
Intel Fortran supports function pointers, though not using F2003 syntax.
You can do some class-like things with generics and defined operators. I've seen some good attempts at doing OO programming with Fortran.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
585 Views

Fortran-9x is not an OO language, although many concepts can be used/emulated. Check out this list of articles. (Decyk/Norton/Szymanskiare the most prolific authors in this field, so I suggest checkingtheir articles first)

CVF/IVF have pointers-to-functions as an extension (not compatible with future F2003 standard). Check out e.g. MAPI module+sample on my home page to see how it's implemented.

Jugoslav

0 Kudos
Reply