Design and Implementation of Weibo in IOS development
//// main.m// Microblog//#import
#import Person.h#import BlogMaster.h#import Microblog.hint main(int argc, const char * argv[]){ Person * person = [[Person alloc]init]; [person showName]; NSLog(@%@,person); Person * man = [[Person alloc]init]; [man showName]; //Microblog * microblog = [[Microblog alloc]init]; return 0;}
# Import
@ Interface Person: NSObject {/** used to record the Person's name */NSString * _ name;/** used to record the Person's age */int _ age; /** used to record the date of birth */NSString * _ birthday;/** used to record Gender */char _ sex;/** used to record location */NSString * _ address; /** used to record emotional conditions */NSString * _ emotion;/** used to record blood type */NSString * _ bloodType;} @ property NSString * name; @ property int age; @ property NSString * birthday; @ property char sex; @ property NSString * address; @ property NSString * emtion; @ property NSString * bloodType;-(void) showName; @ end
# Import Person. h # import
@ Implementation Person-(void) showName {NSLog (@ name of the publisher); // NSLog (@ % @, _ name);}-(NSString *) description {return [NSString stringWithFormat: @ name =%@ age = % d Date of Birth =%@ gender = % c address =%@ emotional condition =%@ blood type =% @, _ name, _ age, _ birthday, _ sex, _ address, _ emotion, _ bloodType];} @ end
# Import
# Import BlogMaster. h # import Person. h @ interface Microblog: NSObject {/** is used to store the master information * // BlogMaster * _ blogMaster;/** is used to store the registration time */NSString * _ registerTime; /** Introduction */NSString * _ introductionAboutBlog;/** used to record Blog content */NSString * _ blogContent;/** used to record comment content */NSString * _ commentContent; /** used to record the number of comments */int _ commentAmount;/** used to record the number of likes */int _ praiseAmount; /** used to record the microblog posting time */NSString * _ publishTime;/** used to record the number of forwards */int _ transhortd;} @ property NSString * registerTime; @ property NSString * introductionAboutBlog; @ property NSString * blogContent; @ property NSString * commentContent; @ property NSString * publishTime; @ property int commentAmount; @ property int praiseAmount; @ property int transtmd; //-(void) printBlogMasterName :( Person *) person; @ end
# Import Microblog. h @ implementation Microblog //-(void) printBlogMasterName :( Person *) person // {// if ([Person isKindOfClass: [BlogMaster class]) // {// BlogMaster * master = (BlogMaster *) person; //} // [master showName]; //}-(NSString *) description {return [NSString stringWithFormat: @ Blog content = % @ comment COUNT = % d likes = % d posting time = % @ forward COUNT = % d, _ blogContent, _ commentAmount, _ praiseAmount, _ publishTime, _ tranmongod];} @ end
#import Person.h@interface BlogMaster : Person{ }-(void)showName;@end
# Import BlogMaster. h @ implementation BlogMaster-(void) showName {NSLog (@ blogger name);} @ end