Reputation: 3902
Recently I faced a question in a exam, "What are the Root Class in Objective-C?" and I got two class as root class in Objective-C
a) NSProxy b) NSObject.
What is the difference between a Root Class & Base Class in Objective-C
?
Upvotes: 2
Views: 2522
Reputation:
A root class inherits from no other class and defines an interface and behavior common to all objects in the hierarchy below it. All objects in that hierarchy ultimately inherit from the root class. A root class is sometimes referred to as a base class.
Upvotes: 1
Reputation: 71058
"Base class" is usually interchangeable with "superclass" (the normal ObjC terminology) when talking about a particular object's design and inheritance.
A root class in ObjC is a class which has no superclass; it is the ultimate base class from which other classes are typically derived. The standard root class for almost all objects in the Cocoa frameworks is NSObject
, although there are others.
Upvotes: 5