Why isn't permitted to derive a class from two different classes that are in turn derived from class 'matlab.mi​xin.Hetero​geneous'?

5 次查看(过去 30 天)
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
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 个)

类别

Help CenterFile Exchange 中查找有关 Construct and Work with Object Arrays 的更多信息

标签

尚未输入任何标签。

产品


版本

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by