Question from obj-c test:

What is not supported in Objective-C?

  • Recursive method call
  • Variable number of arguments to the method
  • Byte manipulations
  • The default value of the argument method
  • None of the above

There may be more than one correct answer. How do I understand this "Variable number of arguments of the method" but can there be another option "Default value of the method argument"?

    2 answers 2

    The default value of the method argument is not supported, byte operations are supported in with, and therefore in obj-c as having full compatibility with it, and by recursion it is enough to pull the [self method] instead of [super method] once in the successor in the method and the presence of recursion is somehow remembered by itself :).

    True, both tricks can be implemented through the introduction of several functions, all of which will call the most complete variant with empty values ​​or with default values ​​like

    -(id) init{ return [self initWithFrame:CGRectNull]; } 

    UPD Variable number of arguments for a method can be done via va_list

    • About recursion, it is yes) Thanks for the rest - very informative! - AlexThumb 5:41 pm
    • >> A variable number of arguments for the method is not supported. Here they think otherwise: idev.by/ios/snippets/8189 - nitrocaster
    • I have antivirals on her swears - aknew
    • one
      @aknew, you'd be so ashamed to say that out loud. A variable number of arguments is supported. Or never NSLog? arrayWithObjects? - AlexDenisov 6:09 pm
    • one
      Yes, I already realized it myself, even wrote it through what is being done in the commentary to another question: (I will correct the answer so that people do not mislead - aknew

    The default value of the argument method. The answer to the first link in the issue for the query "default argument values ​​in objective c" .

    • only these are two different methods, not the default value, so the answer to the question whether the default value is supported is not. Although it can have a variable number of values ​​and can be dragged through the sashny va_list - aknew 5:42 pm
    • >> only these are two different methods, not the default value. What does this relate to? >> so what exactly is the answer to the question whether the default value is supported? The question was "which of the above is not supported", and not "what is supported." - nitrocaster pm
    • "Is this what it is?" k - (id) myFunction: (NSArray *) array {return [self myFunction: array withSort: FALSE]; } from the first link - aknew
    • Um, it means tricky Yandex slips different results. I meant this: No, default arguments are a feature of C ++, not C or Objective-C ( stackoverflow.com/questions/871796/… ) - nitrocaster
    • No, Yandex has nothing to do with it - I did not see this answer, it stands at my very bottom. In general, we had in mind the same thing :) - aknew