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