标签:des style class blog code http
Objective-C is a class-based object system. Each object is an instance of some class; the object‘s The class‘s method list is the set of instance methods, the selectors that the object responds to. When you send a message to an instance, Each Objective-C class is also an object. It has an
What about the metaclass? Is it metaclasses all the way down? No. A metaclass is an instance of the root class‘s metaclass; the root metaclass is itself an instance of the root metaclass. The More important is the superclass of a metaclass. The metaclass‘s superclass chain parallels the class‘s superclass chain, so class methods are inherited in parallel with instance methods. And the root metaclass‘s superclass is the root class, so each class object responds to the root class‘s instance methods. In the end, a class object is an instance of (a subclass of) the root class, just like any other object. Confused? The diagram may help. Remember, when a message is sent to any object, the method lookup starts with that object‘s In proper computer science language theory, a class and metaclass hierarchy can be more free-form, with deeper metaclass chains and multiple classes instantiated from any single metaclass. Objective-C uses metaclasses for practical goals like class methods, but otherwise tends to hide metaclasses. For example, |
from -> http://www.sealiesoftware.com/blog/archive/2009/04/14/objc_explain_Classes_and_metaclasses.html
objects classes and metaclasses in Objective-C,布布扣,bubuko.com
objects classes and metaclasses in Objective-C
标签:des style class blog code http
原文地址:http://www.cnblogs.com/azxfire/p/3807128.html