The default base class for object classes c

The answer to this question may be obvious, but I have to ask him to be sure:

Do all classes in class c have a common common base class by default when the base class is not explicitly expressed in the class definition?

+4
source share
1 answer

No, unless you explicitly define a superclass in the class definition, you create a root class .

From Cocoa Core Competencies :

The root class inherits from another class and defines the interface and behavior common to all objects in the hierarchy below it. All objects in this hierarchy are ultimately inherited from the root class. The root class is sometimes called the base class.

The root class of all Objective-C classes is equal to NSObject , which is part of the Foundation structure. All objects in a Cocoa or Cocoa Touch application are ultimately inherited from NSObject. This class is the primary access point at which other classes interact with the Objective-C runtime. It also declares the interface of the main object and implements the behavior of the main objects, including introspection, memory management, and method invocation. Cocoa and Cocoa Sensory objects gain the ability to behave like objects for the most part from the root class.

enter image description here

The fundamental structure defines another NSProxy root class, but this class is rarely used in Cocoa applications and never works in Cocoa Touch applications.

See also:

+12
source

All Articles