Return the name of the class instance with the highest 'someValue' instance variable
- by Timbo
I have a brand new Objective-C class called test. The test class has an instance variable called someValue, which contains an integer.
I create 5 instances of the test class called aTest, bTest, cTest, dTest and eTest. The appropriate synthesize and property declarations for someValue are in place.
Is there a clean way of returning the name of the class instance with the highest someValue value out of all the existing test class instances? The number of class instances may vary from the 5 in my example.
Note I don't care what the value is, I just want to return the name of the class instance with the highest 'someValue' instance variable.
I've tried a few NSMutable arrays however can only get the value not the name of the variable that contains it.
Thanks in advance