Type Method

class

Returns the class object.

Declaration

+ (Class)class;

Return Value

The class object.

Discussion

Refer to a class only by its name when it is the receiver of a message. In all other cases, the class object must be obtained through this or a similar method. For example, here SomeClass is passed as an argument to the isKindOfClass: method (declared in the NSObject protocol):

BOOL test = [self isKindOfClass:[SomeClass class]];

See Also

Identifying Classes

+ superclass

Returns the class object for the receiver’s superclass.

+ isSubclassOfClass:

Returns a Boolean value that indicates whether the receiving class is a subclass of, or identical to, a given class.