On 11-Jan-09, at 6:32 PM, [email protected] wrote:
Still,
anyone wants to give me some guidance on protocols and how they should
be employed, I'm all ears (eyes).
Well, here's one I just employed. Define it like this
@protocol PAImageCollection <NSObject>
@required
- (int)collectionCount;
- (UINavigationController *)collectionController;
- (NSString *)fileForIndex:(int)collectionIndex;
- (BOOL)canRemove;
@end
and then any class you declare like this
@interface FavoritesTableViewCell : UITableViewCell <PAImageCollection>
will throw up a compile error if it doesn't match everything under
@required in the protocol.
And to keep track of a derived instance as a variable/argument,
something like
id<PAImageCollection> collection;
does the trick.
That should pretty much cover any sane use of pure virtual functions
you have in mind.
--
Alex Curylo -- [email protected] -- http://www.alexcurylo.com/
"I misjudged you Alex; you're a @#$%!!, but you're a consistent,
smart $...@%^!!, and the kind of @$^#&$!! I can #...@*&!! respect."
-- John G. Spragge
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]