Function VS Method


On the first page of chapter 14 it says “NSLog() is an Objective-C function (not a method!) that works a lot like printf()”.

What is the difference? Is the implication here that methods exist on objects and functions exist on non-objects?.. Or?

Thank you


Yes, you have the gist of it wright.

In a nut shell, a method is a function that operates on a piece of data (object) whose structure is described by a class. Thus, a method has a close affinity to its class, and takes the object on which it is invoked as an additional but hidden argument.


Trying to put it in even more easy way to get: method IS a function that belongs to some class.