[译]2013-10-25 NSObject: the Class and the Protocol
原文链接: https://mikeash.com/pyblog/friday-qa-2013-10-25-nsobject-the-class-and-the-protocol.html Reader Tomas Bouda asks: what's the deal with the NSObject protocol? There are two NSObjects in Cocoa, a class and a protocol. Why both? What purpose do they serve? In today's article, I'll explore the answer to this question. 读者Tomas Bouda问我:“NSObject协议应该怎么理解呢?在Cocoa中有两处NSObject,一处是NSObject类,另一处是NSObject协议。为啥会有两个呢?他们到底有什么作用?”。在今天的文章里,我将会探讨这个问题。 Namespaces 命名空间 First, let's look at how these two entities with the same name can coexist. Classes and protocols in Objective-C inhabit entirely separate