Understanding the NSNumber Abstract Superclass

I am reading a book about objective C, and they say that NSNumberis abstract superclassfor many subclassesthat we can use.

So, "when we call the method in NSNumber, the appropriate subclass is used."

This is not consistent with another rule that I know:

if superclass Ahas subclass B, and you call the method in superclass A , which is in subclass B , you cannot do this because inheritance works to the end, not down.

So how does it work superclass (abstract) class- NSNumber, uses its methods subclass?

What is the hierarchy here?

Thanks.

+4
source share
2

.
:

. , - , .

, factory, +numberWithInt:, factory . , - -stringValue:, NSNumber - int .
, NSNumber factory NSNumber - . Cocoa - NSArray, NSDictionary, NSSet.

+4

NSDoubleNumber, NSLongLongNumber, NSIntegerNumber .. ( ), . , , , , , .

Objective-C , , , "NSDoubleNumber" - , .

, "NSNumber" , .

(, NSArray, NSDictionary .)

+2
source

All Articles