question

Pedro Ortelani avatar image
1 Like"
Pedro Ortelani asked Pedro Ortelani edited

Multiple Inheritance in Module Development

I am trying to create a class that creates and destroys flowitems, my first approach would be making a class that inherits from Source and Sink, and call their methods based on the input/output nodes values.

But I am getting a compiler error on the return new Class on the createodtderivative method, because it has ambiguous base class ObjectDataType.

Is it possible to use Multiple Inheritance in Module Development?

If no, would the best solution be creating a custom Fixed Resource from scratch with both Source and Sink functionalities?

Thanks!

FlexSim 20.0.2
module sdkdevelopment
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Jordan Johnson avatar image
1 Like"
Jordan Johnson answered Pedro Ortelani commented

Hi Pedro,

In order to create and destroy flowitems, you don't need to inherit from either the source or the sink. To create a flowitem, all you need to do is use createcopy() to copy something in the flowitem bin. To destroy a flowitem, you can use the treenode's destroy method, called on the flowitem. In your case, you should just inherit FixedResource.

In some cases, you can use multiple inheritance in module development. However, since the Source and Sink class both inherit from FixedResource, you can't. It's called the diamond problem, and we haven't written our code to allow you to work around this issue.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Pedro Ortelani avatar image Pedro Ortelani commented ·

Understood! Thanks for the information!

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.