Clear Filters
Clear Filters

what relational operator is comparing without class method overloading

1 view (last 30 days)
Hello,
I was looking the example code for "Introduction to Object-Oriented Programming in MATLAB® Webinar": http://www.mathworks.com/matlabcentral/fileexchange/23616
In scenario "5 - Inheritance", I found I can compare like, balloon{1} > balloon{2}; ans=0 or balloon{2} > balloon{3}; ans = 1, without overloading the conditional operators. Arithmetic operatros will give errors without overloading which makes sense.
My question is what MATLAB is comparing for those objects, their cell array index? or inhreitance order? or some property value?
So far the retunred result is confusing. For example, balloon{1} and balloon{2} are the target class, balloon{3} is a subclass of target, if I add a balloon{5} which is also target class as balloon{1} and balloon{2}, it shows balloon{5} > balloon{2}; ans = 0, and balloon{5} > balloon{4}; ans = 1.
I knwo metaclass instance can use greater than or less than to figure out subclass relationship. But what are they doing in above situations?
Thanks

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!