我正在尝试在 Fortran 中使用多态性,但我在分配类型时遇到了问题。我不知道如何使这项工作。英特尔编译器抛出此错误:
error #6460: This is not a field name that is defined in the encompassing structure.
analitic%param%a0=2
---------------^
这是一个最小的例子:
program new
implicit none
integer, parameter    :: dp = kind(1.0d0)
type :: potential
  class(*),allocatable                        :: param
endtype
type(potential)          :: analitic
type  :: pa1d_param
  real(dp)     :: a0
  real(dp)     :: b0
end type
allocate(pa1d_param::analitic%param)
analitic%param%a0=2.0_dp     
end program
这里有什么问题?
谢谢!