objective c - How would you define a simple "min" method in obj-c -
I want to define minimum and maximum methods in a utility class.
uses @interface Int minutes (int a, int b); Integer maximum (int one, int b); @end
But I do not have to designate the parameters. It would be a very heavy mark I wanted to use the C-style definition but then [Utils Min (A, B)]
does not work as a call, what's my problem?
Thank you in advance for any help
Since you are the Objective-C OS Do not use X implementations, you do not have access to predefined MIN and MAX macros.
You can define yourself
#define (A, B) (A) and (B) (A): (B)) # Define maximum (A, B) ((A)> (B)? (A): (B))
Probably a better way of defining them, but this is your use Will create a simple macro for. You can add them to any common .h file that normally shares your classes.
Comments
Post a Comment