Код IT
← Каталог

Справочник по языку Fortran — 10.1. Производные типы с процедурами

Фрагмент из «Справочник по языку Fortran»: 10.1. Производные типы с процедурами.

Fortran main.f90
module shape_mod
  implicit none

  type :: shape
  contains
    procedure :: area => shape_area
  end type shape

contains

  real function shape_area(this)
    class(shape), intent(in) :: this
    shape_area = 0.0
  end function shape_area

end module shape_mod
module shape_mod
  implicit none

  type :: shape
  contains
    procedure :: area => shape_area
  end type shape

contains

  real function shape_area(this)
    class(shape), intent(in) :: this
    shape_area = 0.0
  end function shape_area

end module shape_mod