| Start |
|---|
| Class methods A class method is called on the class the method belongs to, not an instance of it. This is possible because Objective-C classes are also objects. To denote a method as a class method, change the |
| Method parameters If you want to pass in values to a method when it is called, you use parameters: The colon ( The parameter type goes in the parentheses The parameter name goes after the parameter type. |
| Create a basic method This is how to create a basic method that logs 'Hello World" to the console: The The The 'hello' is the name of the method. Everything in the |
| Return values When you want to return a value from a method, you put the type you want to return in the first set of parentheses. The value you want to return goes after the |
| Calling methods Calling an instance method: Calling an instance method on the current instance: Calling a method that takes arguments: Calling a class method: |
| Instance methods An instance method is a method that's available on a particular instance of a class, after the instance has been instantiated: Here's how you define one: |
| Pass by value parameter passing In pass by value of parameter passing to a method, actual parameter value is copied to formal parameter value. So actual parameter value will not change after returning from called function. Calling the methods: Output: |
| Pass by reference parameter passing In pass by reference of parameter passing to a method, address of actual parameter is passed to formal parameter. So actual parameter value will be changed after returning from called function. Calling the methods: Output: Syntax |
Read Article
https://develop.horje.com/learn/1434/reference