您的位置:首页 > 移动开发 > Objective-C

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

2010-10-15 12:54 801 查看
  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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: