Fact 3: Methods Are Functions, and Message Expressions Are Function Calls

Methods are really functions. When you invoke a method, you call a function associated with the class of the receiver. The arguments passed to the function are the receiver (self) and the method’s arguments. So all the rules about passing arguments to functions, return values, and automatic and static variables are the same whether you’re talking about a function or a method. The Objective-C compiler creates a unique name for each function using a combination of the class name and the method name.

Get Programming in Objective-C, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.