Why do three classes A, B and C, where A implies inferiorto (B) and C implies superiorto (B), does not automatically imply C > A?
1 view (last 30 days)
Show older comments
I have three classes A, B, C and I defined the following in the constructor of A:
inferiorto('B');
As well as the following in the constructor of C:
superiorto('B');
This can be expressed as A < B and C > B meaning A < B < C.
Calling the following code in MATLAB gets executed correctly as specified in the comment in each line:
a + b % Executes B/plus.m
b + a % Executes B/plus.m
b + c % Executes C/plus.m
c + b % Executes C/plus.m
However, calling the following line of code executes "A/plus.m" although it should execute "C/plus.m":
a + c
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
The ability to automatically deduce inferiority or superiority between two classes that do not have a direct relationship is not available in MATLAB.
To work around this issue, define the following in the constructor of C:
superiorto('B', 'A');
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!