Method signature

From Wikipedia, the free encyclopedia

In computer programming, especially object-oriented programming, a method is commonly identified by its unique method signature. This usually includes the method name, the number and type of its parameters, and its return type. A method signature is the smallest type of a method.

In the Objective-C programming language, method signatures for an object are declared in the interface header file. For example,

- (id)initWithInt:(int)value;

defines a method initWithInt that returns a general object (an id) and takes one integer argument. Objective-C only requires a type in a signature to be explicit when the type is not id; this signature is equivalent:

- initWithInt:(int)value;

In the Java programming language, method signatures for an object is the method name and the number and type of its parameters. Return types are not considered to be a part of the method signature.

- return_type method_name(parameters) {...}

[edit] See also


In other languages