| 查看: 432 | 回复: 1 | |||
chenshuai000金虫 (正式写手)
|
[求助]
fortran 求助 已有1人参与
|
|
module shiliang implicit none type vector real*8 v(4) endtype end module type(vector) ::W1,W2 我想实现直接W1=W2,即实现两个结构体变量之间的直接赋值操作,请问这个赋值号超载该怎么写?谢谢 发自小木虫Android客户端 |
» 猜你喜欢
环境285分,过六级,求调剂
已经有4人回复
学硕化学工程与技术,一志愿中国海洋大学320+求调剂
已经有3人回复
能源动力 调剂
已经有3人回复
348求调剂
已经有4人回复
材料化工340求调剂
已经有5人回复
08工科求调剂290分
已经有6人回复
材料调剂
已经有3人回复
372分材料与化工(085600)一志愿湖南大学求调剂
已经有4人回复
283分材料与化工求调剂
已经有4人回复
一志愿华东理工大学,080500学硕,317分,求调剂
已经有12人回复
【答案】应助回帖
感谢参与,应助指数 +1
|
[code] module m_test implicit none private public :: t_test type t_test real(8) :: v(4) contains procedure :: assign generic :: assignment(=) => assign end type t_test contains subroutine assign(lhs, rhs) implicit none class(t_test), intent(inout) :: lhs class(t_test), intent(in) :: rhs lhs%v = rhs%v return end subroutine assign end module m_test program test use m_test implicit none type(t_test) :: a, b a%v = 4 a%v(2) = 2 b = a write(*, *) b%v(2) end program test [\code] |

2楼2016-01-21 19:18:17














回复此楼