Home > Articles > Programming > General Programming/Other Languages

  • Print
  • + Share This
This chapter is from the book

Q&A

  • Q. Why does init return an id?

    A. By returning an id, which is often a reference to the object on which it was called, it allows init to substitute a new object for the original one. Increasingly, the declarations are being changed to use the new instanceType return value, which allows for more error checking. Each new release of iOS adds more of these revisions.

  • Q. What is the difference between a class method and an instance method?

    A. You must have an instance of a class to use an instance method; you can simply call a class method with the class name (that is, you do not need an instance). Class methods are often used as factory methods to create new instances of the class.

  • + Share This
  • 🔖 Save To Your Account