Ray's playground

 

Data Types and Expressions(Chapter 4 of Programming in Objective-C 2.0)

  The id data type is used to store an object of any type. In a sense, it is a generic object type. For example, this line declares number to be a variable of type id:
  id number;
  Methods can be declared to return values of type id, like so:
  -(id) newObject: (int) type;
  This declares an instance method called newObject that takes a single integer argument called type and returns a value of type id. Note that id is the default type for return and argument type declarations. So, the following declares a class method that returns a value of type id:
  +allocInit;

posted on 2010-10-15 12:54  Ray Z  阅读(230)  评论(0编辑  收藏  举报

导航