Methods ? (Objective-C)
Different parts of a method
1. Instance (-) or Class (+) indicator
2. Return type –> the class within the parentheses ( )
3. Method Name –> descriptive and appropriate naming
4. (optional) Arguments –> type and name
5. Method Body
-Instance Method: give information about or perform an operation on an instance’s instance variable
1. send a message to a class to create instance
2. message causes class method to be executed
3. that instance receives messages
instance methods executed
-Declaring a Method: (usually done in the .h file)
- (NSString *)deliverChipsForSelection: (NSUInteger)selection withPaymentInCents: (NSUInteger)paymentInCents;
–> (NSString *) - return type
–> deliverChipsForSelection - method name
–> : - states that there are arguments (parameters) which the method accepts. Items after ‘:’ are the arguments
–> ; - ends the declaration of a method
-Making a Method Call:
i.e.
- (NSString *)deliverChipsForSelection: (NSUInteger)selection withPaymentIncents: (NSUInteger)paymentInCents {
// The body of the method is inserted here
return NSString
}





