Object Oriented Programming with Fortran: Glossary

Key Points

Introduction
  • Fortran supports object oriented design.

  • Some consideration for performance should be taken with object oriented design early on, e.g. create objects containing arrays rather than arrays of objects.

Modules
  • Modules are used to package variables, types, and procedures together.

  • Access to variables and procedures within the module can be controlled with the private and public access modifiers.

Derived Types
  • A derived type allows you to package together a number of basic types that can then be thought of collectively as one new derived type.

  • Access modifiers can be applied within derived types as well as within modules to restrict access to members of that derived type.

Extended Types
  • Type extension allows you to build upon an existing derived type to create a new derived type while adding new functionality or modifying existing functionality.

  • Allows reuse of common code between derived types.

Interface Blocks
  • An interface block can act as either a block of definitions of your procedures (explicit interface) or as a means of associating different procedures with one common name (generic interface).

  • Procedures that are part of the same generic interface block must be distinguishable from each other based on the number, order, and type of arguments passed.

Type Bound Procedures
  • A type bound procedure allows you to associate a procedure with a type.

  • Extended types can use these type bound procedures by using the class keyword rather than the type keyword.

  • select type allows different code paths to execute based on the object’s type similar to select case.

Destructors
  • A destructor is used to perform clean up when an object goes out of scope.

  • To create a destructor use the final keyword when declaring at type bound procedure instead of the procedure keyword.

Operator Overloading
  • Common Fortran operators can be overloaded to work with your custom derived types.

Wrapping Up

Glossary

FIXME