Trying to merge two polygon classes... (OOP help)

Thanks Jose. If I understand, in that loop it is always the same instance of the object that is used. In my mind I was thinking that each hat was a different instance created by my set procedure…

Could another solution be to use a BLOCK? something like:

        do i = 1, 7
            block
                type(Hat_polykite)  :: hat
                call hat%set(start=cmplx(x+10._dp, y, dp), hx_side=HX_SIDE)
                call hat%draw(cr)
            end block
            y = y + sqrt(3._dp) * HX_SIDE
        end do

with the associate inside the class module.