MATLAB: Do three classes A, B and C, where A implies inferiorto (B) and C implies superiorto (B), does not automatically imply C > A

classinferiortoMATLABoperationoperatoroverloadoverloadingsuperiorto

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

Best Answer

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');