Reputation: 13429
In c# i can create functions can return any type of objects like
(ArrayList) funtionName()
{
return ArrayList;
}
is this possible in Obj-c? thanks.
Upvotes: 0
Views: 3761
Reputation: 54445
Yes, Objective-C can return objects, etc. although you're nearly always returning a pointer to the object.
e.g.:
- (NSArray *)getSomeStringsInAnArray{
NSArray *someStrings = [NSArray arrayWithObjects:
@"Hello",
@"world",
nil];
return someStrings;
}
I'm guessing you might want to read Apple's "The Objective-C Programming Language" guide, as it gives a good background to such things.
Upvotes: 5