Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to explain this Objective C method declaration "- method:parameter;"

Tags:

People also ask

How do you declare method in Objective-C?

An Objective-C method declaration includes the parameters as part of its name, using colons, like this: - (void)someMethodWithValue:(SomeType)value; As with the return type, the parameter type is specified in parentheses, just like a standard C type-cast.

What is parameter declaration in C?

The function declarator includes the list of parameters that can be passed to the function when it is called by another function, or by itself. In C++, the parameter list of a function is referred to as its signature. The name and signature of a function uniquely identify it.

What is method declaration in C?

A function consist of two parts: Declaration: the function's name, return type, and parameters (if any) Definition: the body of the function (code to be executed)

How do you explain a function declaration?

A function declaration tells the compiler about a function name and how to call the function. The actual body of the function can be defined separately. int max(int, int); Function declaration is required when you define a function in one source file and you call that function in another file.


Declaring, implementing and using method like this:

Test.h:

- method:parameter;

Test.m:

- method:parameter{
    return nil;
}

Using:

[test method:anObject];

There is no return-type and parameter-type, but it works without any warning or error. Can somebody explain it?