I have following:
type t_octree
real :: box(2,3)
type(t_octree), pointer :: parent => NULL()
type(t_octree), pointer :: children(:) => NULL()
contains
final :: DESTROY_OCTREE
end type t_octree
interface t_octree
module procedure :: INIT_OCTREE
end interface t_octree
now my constructor or desctructor:
subroutine INIT_OCTREE( this, num_points, box )
implicit none
class(t_octree) :: this
integer :: num_points
real :: box(2,3)
(...)
end subroutine INIT_OCTREE
subroutine DESTROY_OCTREE( this )
implicit none
type(t_octree) :: this
(....)
end subroutine DESTROY_OCTREE
Can somebody explains why both work, i.e. if I declare with type(t_octree) :: this
and class(t_octree) :: this
.
I compiled both cases, and they worked. So what is the differences specifically here?
and when should we use which?