0
我試圖用Fortran使用多態,但我有分配型的問題。我無法弄清楚如何使這項工作。英特爾編譯器拋出這個錯誤:在Polymoprhic分配類型變量的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
這裏有什麼問題?
謝謝!