| 查看: 395 | 回复: 1 | |||
chenshuai000金虫 (正式写手)
|
[求助]
fortran 求助已有1人参与
|
|
module shiliang implicit none type vector real*8 v(4) endtype end module type(vector) ::W1,W2 我想实现直接W1=W2,即实现两个结构体变量之间的直接赋值操作,请问这个赋值号超载该怎么写?谢谢 发自小木虫Android客户端 |
» 猜你喜欢
职称评审没过,求安慰
已经有21人回复
垃圾破二本职称评审标准
已经有15人回复
投稿Elsevier的Neoplasia杂志,到最后选publishing options时页面空白,不能完成投稿
已经有20人回复
EST投稿状态问题
已经有7人回复
毕业后当辅导员了,天天各种学生超烦
已经有4人回复
聘U V热熔胶研究人员
已经有10人回复
求助文献
已经有3人回复
投稿返修后收到这样的回复,还有希望吗
已经有8人回复
三无产品还有机会吗
已经有6人回复
【答案】应助回帖
感谢参与,应助指数 +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













回复此楼