**
Method overLoading In Objective C:
**
method overloading concept in object oriented language we use the same method name with the different signature. Signature is the argument that we send using the function.
we just change the number of argument in the method calling and which method have the same number of argument from calling function then that method is called.
@interface Person : NSObject
-(void) showNumber:(double)x
{
NSLog(@"Hello First mehod value==%f",x);
}
-(void)showNumber:(double)x and:(int)y{
NSLog(@"Method overLoaded value==%f and second value=%d",x,y);
}
@end
int main(void) {
Person *perObj = [Person new];
[perObj showNumber:5.0f];
[perObj showNumber:5.0f and:10];
}
0 Comment(s)