Guest User

Untitled

a guest
Jan 16th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. typedef NS_ENUM (NSUInteger,PostType){
  2. PostTypeVideo,
  3. PostTypePhoto,
  4. PostTypePlain,
  5. };
  6. @interface Post:NSObject
  7. @property (copy) NSString *title;
  8. @property NSDate *createdDate;
  9. // helper for creating Post Object
  10. + (Post*) postWithType:(PostType)type;
  11. - (void) animatePost;
  12. @end
  13. @implementation Post
  14. +(Post*)postWithType:(PostType)type{
  15. switch(type){
  16. case PostTypeVideo :
  17. return [PostVideo new];
  18. break;
  19. case PostTypePhoto :
  20. return [PostPhoto new];
  21. break;
  22. case PostTypePlain:
  23. return [PostPlain new];
  24. break;
  25. }
  26. }
  27. -(void) animatePost{
  28. // Subclasses implements this
  29. }
  30. @end
  31. @interface PostVideo : Post
  32. @end
  33. @implementation PostVideo
  34. - (void)animatePost{
  35. NSLog(“This is an video Animation Code!!!!")
  36. }
  37. @end
Add Comment
Please, Sign In to add comment