Derived Type with members with mutable type

Christopher Dimech dimech.christopher@gmail.com
Sat Jun 27 14:35:00 GMT 2015


I am writing an interval derived type. The task is to create a derived
type where the type of min and max can change. There are times where I
need min and max to be integers, other times I need then to be reals.

My problem is how to set the values in the derived type. I think I can
use unlimited polymorphic components but unsure of the correct details
that have to be implemented.

Type Interval

  Class (*) :: min, max

  Contains
    Procedure :: set => interval_set

End Type Interval

  Contains

Subroutine interval_set  &
  (                      &
    t, min, max          &
)

  Class (Interval), Intent (InOut) :: t
  Class (*), Intent (In) :: min, max

End Subroutine interval_set



More information about the Fortran mailing list