Home Tutorial Iphone Examples Declaring Method in Objective C

 
 

Share on Google+Share on Google+
Declaring Method in Objective C
Posted on: September 30, 2010 at 12:00 AM
Advertisement
In Objective C we can declare two types of methods "Class Method" and "Instance Method" Where + sing denotes the Class method and - sign denotes the Instance method.

Declaring Method in Objective C

In Objective C we can declare two types of methods "Class Method" and "Instance Method" Where + sing denotes the Class method and - sign denotes the Instance method.

For example:

+ (void) printData;
- (void) printData;

The forgoing Objective C methods are declared without parameters. It only takes method type (+ & -), return type (void) and the method name (printData).

You can also declared a method with parameters. Objective C Method also accept more then one parameter. for example…

Objective C method declaration with single parameter:

+ (void) getId: (NSString *) yourId;
- (void) getId: (NSString *) yourId;

Objective C method declaration accepts more than one parameter:

+ (void) getId: (NSString *) yourId andName : (NSString *) yourName;
- (void) getId: (NSString *) yourId andName : (NSString *) yourName;

Advertisement

Related Tags for Declaring Method in Objective C:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: September 30, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com