It All Begins at the Root
You learned about the idea of a parent class in Chapter 3, “Classes, Objects, and Methods.” A parent class can itself have a parent. The class that has no parent is at the top of the hierarchy and is known as a root class. In Objective-C, you can define your own root class, but it’s something you normally won’t want to do. Instead, you want to take advantage of existing classes. All the classes we’ve defined up to this point are descendants of the root class called NSObject, which you specified in your interface file like this:
@interface Fraction: NSObject...@end
The Fraction class is derived from the NSObject class. Because NSObject is at the top of the hierarchy (that is, there are no classes above it), it’s called ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access