简体   繁体   English

如何在OMNeT ++中创建消息(.msg)的子类?

[英]How can I create a subclass of a message (.msg) in OMNeT++?

I'm wondering whether it's possible to create a subclass of a message declaration (file *.msg which extends cPacket, see OMNeT++ Simulation Library ). 我想知道是否可以创建消息声明的子类(扩展cPacket的文件* .msg,请参阅OMNeT ++ Simulation Library )。 What I've tried so far is: 到目前为止,我尝试过的是:

packet childPacket : parentPacket{...}

and

parentPacket childPacket {...}

which both can't be compiled by opp_msgc . 两者都不能由opp_msgc编译。

Thus, I haven't found a way so far to achieve this and I'm very thankful for any hints. 因此,到目前为止,我还没有找到实现此目标的方法,对于任何提示,我非常感谢。

Cheers 干杯
- alex -亚历克斯

The solution is really simple and most probably it just shows my lack of knowledge in c++ (I thought 'extend' was just used in java)... 该解决方案非常简单,很可能只是表明我缺乏对c ++的了解(我认为'extend'只是在Java中使用的...)

Finally, I could achieve my goal described above by just typing 最后,我只需输入以下内容即可实现上述目标

packet childPacket extends parentPacket{...}

Oh gosh, it's hot in herre... 哦,天哪,这里的天气很热...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM