Why isn't permitted to derive a class from two different classes that are in turn derived from class 'matlab.mixin.Heterogeneous'?
5 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2021-8-2
回答: MathWorks Support Team
2021-8-2
It is sought to have a class diagram, where multiple inheritance is used for classes that are derived from the 'matlab.mixin.Heterogeneous' class. However, when trying to instantiate an object from these derived classes, the following error message is asserted,
Error using myDerivedClass
Class 'myDerivedClass' has two or more direct superclasses derived from
matlab.mixin.Heterogeneous, which is not permitted.
Why isn't permitted to derive a class from two different classes that are in turn derived from class 'matlab.mixin.Heterogeneous'?
采纳的回答
MathWorks Support Team
2021-8-2
This is the expected behavior of the software, see the following documentation page for more information,
where in the section about "Restrictions on Heterogeneous Array Formation" it is mentioned that,
"You can form heterogeneous arrays with objects that derive from multiple superclasses, but only one branch in the hierarchy can define a heterogeneous root."
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Construct and Work with Object Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!