Fortran Coder

interface assignment 和interface operator写为type-bound procedure形式

查看数: 8448 | 评论数: 4 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2016-4-20 15:20

正文摘要:

使用interface assignment 以及interface operator可以为type定义操作符和赋值符; 但是如何将其写为type-bound procedure的形式呢? 这个是书本的例子,但是肯定是错误的,至少没有用procedure语句声明assign1,p ...

回复

wx_G5fH8Rhq 发表于 2016-4-21 10:14:54
pasuka 发表于 2016-4-21 09:48
可以参考这个回答,pass属性应该是编译器默认的
http://stackoverflow.com/questions/5502592/procedure-po ...

谢谢大神给的参考,确实很有帮助。
如您所说,这里还真就是OOP的问题,确实超出我现有能力了,所以暂时放下这个,不去纠结了。
fortran学了快两年,还差指针和oop没学···
没办法,本人有繁重的任务,抽空才能学点新东西,磨刀的时间都过去了。。
pasuka 发表于 2016-4-21 09:48:14
可以参考这个回答,pass属性应该是编译器默认的
http://stackoverflow.com/questio ... ointer-derived-type
http://stackoverflow.com/questio ... ttribute-in-fortran
个人看法:
没有面向对象编程OOP基础,选择fortran来上手,无异于开奇瑞QQ车去参加F1大赛
fcode 发表于 2016-4-20 17:06:50
就像书上的例子就可以了。
加上 Procedure :: assign1,plus1,plus2,plus3

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-5-14 20:54

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表