Properties validation in subclass with multiple superclass but same ancestor
3 个评论
Hi @Jacorem,
From what I can see in your code, since both bike and electricalVehicle ultimately inherit from the same vehicle class where required_staff is defined, MATLAB should recognize it's the same property validation rather than treating it as conflicting validations.
A few potential workarounds you might consider:
*Define the property validation in an intermediate class that both inheritance paths go through.
*Use composition instead of multiple inheritance for one of the paths.
*Override the property validation in your concrete class explicitly.
Matt J's comment about this potentially being a documentation vs. implementation issue sounds plausible - it might be worth filing a bug report with MathWorks to get clarification on whether this is intended behavior or a bug.
You might also get more targeted help from MATLAB's technical support since this seems like it could be a edge case in their inheritance implementation. Hope this helps.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Subclass Definition 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!