Overriding: The subclass method overrides the parent class method, requiring the method name and parameters to be the same.
Overloading: Two or more than two method names in the same class, but with different parameters, the method body is also different.
Multi-State dynamic identification
is the object not a member of AClass or its subclasses? if ([Audi Iskindofclass:[car class]]) {NSlog (@ "Audi is a kind of Car");}
is the object not a AClass member? if ([Car Ismemberofclass:[car class]]) {NSlog (@ "Audi is member of Car");}
object is not a AClass subclassif ([Audi Issubclassofclass:[car class]]) {NSlog (@ "Audi is subclass of Car");}
determine whether two objects are of the same typeif ([Audi Class]==[benz class]) {NSlog (@ "Audi and Benz is the same class");}
whether the object responds Aselector the specified methodif ([Car respondstoselector: @selector (Run)]) {NSlog (@ "car responds to Run method");}
The
@selector () precompiled directive specifies the selector, where the method name is in parentheses. the Aselector object invokes the specified method
SEL Action;[email protected] (run);[car performselector:action];equivalent to [car performselector: @selector (run)];
for the method specified like the call Aselector, pass the Parameter object-(ID) Performselector: (SEL) aselector;Withobject: (ID) object;
the Aselector object invokes the specified method, passing parameters Object1 and Object2-(ID) Performselector: (SEL) aselector;Withobject: (ID) object;Withobject: (ID) object;
OC Syntax--polymorphic dynamic recognition and @selector () pre-compilation directives specify selectors