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

조회 수: 4 (최근 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
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개)

카테고리

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