Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef NS_ENUM (NSUInteger,PostType){
- PostTypeVideo,
- PostTypePhoto,
- PostTypePlain,
- };
- @interface Post:NSObject
- @property (copy) NSString *title;
- @property NSDate *createdDate;
- // helper for creating Post Object
- + (Post*) postWithType:(PostType)type;
- - (void) animatePost;
- @end
- @implementation Post
- +(Post*)postWithType:(PostType)type{
- switch(type){
- case PostTypeVideo :
- return [PostVideo new];
- break;
- case PostTypePhoto :
- return [PostPhoto new];
- break;
- case PostTypePlain:
- return [PostPlain new];
- break;
- }
- }
- -(void) animatePost{
- // Subclasses implements this
- }
- @end
- @interface PostVideo : Post
- @end
- @implementation PostVideo
- - (void)animatePost{
- NSLog(“This is an video Animation Code!!!!")
- }
- @end
Add Comment
Please, Sign In to add comment