You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The advantage is that we can mix several different inheritances. E.g.
structNode {};
structDecision {};
structArray {};
structArrayNode : publicArray, publicvirtual Node {};
structDecisionNode: publicDecision, publicvirtual Node {};
structListNode : publicArrayNode, publicDecisionNode {}; //<- this is allowed with virtual inheritance.
The downside is a minor performance hit. Because now ListNode does not necessarily know where in memory the "node parts" are.
Direct inheritance
In this case we just do
structArrayNode : publicArray, publicNode {};
The upside is performance. All the array/node points know their relative position. The downside is that we cannot as easily add/compose new node types. So we end up doing things like
One way we could potentially mitigate the performance hit of virtual inheritance is with liberal use of the final keyword for classes. Though that would make maintaining binary compatibility in the future a bit more tricky.
There are two approaches if we want to go this direction:
Virtual inheritance
See #74 for an example.
The advantage is that we can mix several different inheritances. E.g.
The downside is a minor performance hit. Because now
ListNode
does not necessarily know where in memory the "node parts" are.Direct inheritance
In this case we just do
The upside is performance. All the array/node points know their relative position. The downside is that we cannot as easily add/compose new node types. So we end up doing things like
Next steps
Performance testing needed.
The text was updated successfully, but these errors were encountered: