module shape_module type shape_type integer, private :: x_ = 0 integer, private :: y_ = 0 contains procedure, pass (this) :: getx procedure, pass (this) :: gety procedure, pass (this) :: setx procedure, pass (this) :: sety procedure, pass (this) :: moveto procedure, pass (this) :: draw end type shape_type interface shape_type module procedure shape_type_constructor end interface shape_type interface assignment (=) module procedure generic_shape_assign end interface assignment (=) contains type (shape_type) function shape_type_constructor(x, y) implicit none integer, intent (in) :: x integer, intent (in) :: y shape_type_constructor%x_ = x shape_type_constructor%y_ = y end function shape_type_constructor include 'shape_module_common_code.f90' subroutine generic_shape_assign(lhs, rhs) implicit none class (shape_type), intent (out), allocatable :: lhs class (shape_type), intent (in) :: rhs allocate (lhs, source=rhs) end subroutine generic_shape_assign end module shape_module