Multiple Inheritance in Module Development

Multiple Inheritance in Module Development

pedro_o
Not applicable
48 Views
2 Replies
Message 1 of 3

Multiple Inheritance in Module Development

pedro_o
Not applicable

[ FlexSim 20.0.2 ]

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!

Accepted solutions (1)
49 Views
2 Replies
Replies (2)
Message 2 of 3

JordanLJohnson
Autodesk
Autodesk
Accepted solution

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.

.


Jordan Johnson
Principal Software Engineer
>

Message 3 of 3

pedro_o
Not applicable

Understood! Thanks for the information!