Objective-C Language Methods Calling methods

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Calling an instance method:

[classInstance hello];

 @interface Sample
 -(void)hello; // exposing the class Instance method
 @end

 @implementation Sample
     -(void)hello{
        NSLog(@"hello");
      }
 @end

Calling an instance method on the current instance:

[self hello];

@implementation Sample

     -(void)otherMethod{
       [self hello];
     }

     -(void)hello{
        NSLog(@"hello");
      }
 @end

Calling a method that takes arguments:

[classInstance addInt:1 toInt:2];

 @implementation Sample
     -(void)add:(NSInteger)add to:(NSInteger)to
        NSLog(@"sum = %d",(add+to));
      }
 @end

Calling a class method:

[Class hello];

 @interface Sample
 +(void)hello; // exposing the class method
 @end

 @implementation Sample
     +(void)hello{
        NSLog(@"hello");
      }
 @end


Got any Objective-C Language Question?