你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> IOS開發之微博的設計與實現

IOS開發之微博的設計與實現

編輯:IOS開發綜合
//
//  main.m
//  Microblog
//


#import 
#import Person.h
#import BlogMaster.h

#import Microblog.h

int 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
{
    /**用來記錄人的名字*/
    NSString * _name;
    
    /**用來記錄人的年齡*/
    int  _age;
    
    /**用來記錄出生年月*/
    NSString * _birthday;
    
    /**用來記錄性別*/
    char _sex;
    
    /**用來記錄所在地*/
    NSString * _address;
    
    /**用來記錄感情狀況*/
    NSString * _emotion;
    
    /**用來記錄血型*/
    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(@打印人的名字);
    //NSLog(@%@,_name);
}

-(NSString *)description
{
    return [NSString stringWithFormat:@名字=%@ 年齡=%d 出生日期=%@性別=%c 住址=%@ 感情狀況=%@ 血型=%@,_name,_age,_birthday,_sex,_address,_emotion,_bloodType];
    
}
@end

#import 
#import BlogMaster.h
#import Person.h
@interface Microblog : NSObject
{
    /**用來存儲博主信息*/
    //BlogMaster * _blogMaster;
    
    /**用來存儲注冊時間*/
    NSString * _registerTime;
    
    /**簡介*/
    NSString * _introductionAboutBlog;
    
    /**用來記錄博客內容*/
    NSString * _blogContent;
    
    /**用來記錄評論內容*/
    NSString * _commentContent;
    
    /**用來記錄評論數量*/
    int _commentAmount;
    
    /**用來記錄點贊數量*/
    int _praiseAmount;
    
    /**用來記錄微博發表時間*/
    NSString * _publishTime;
    
    /**用來記錄轉發數量*/
    int _transpond;
}

@property NSString * registerTime;
@property NSString * introductionAboutBlog;
@property NSString * blogContent;
@property NSString * commentContent;
@property NSString * publishTime;
@property int commentAmount;
@property int praiseAmount;
@property int transpond;

//-(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:@ 博客內容=%@ 評論數量=%d 點贊數量=%d 發表時間=%@  轉發數量=%d,_blogContent,_commentAmount,_praiseAmount,_publishTime,_transpond];
}
@end

#import Person.h

@interface BlogMaster : Person
{
    
}
-(void)showName;

@end

#import BlogMaster.h

@implementation BlogMaster
-(void)showName
{
    NSLog(@博主的名字);
}
@end



 

  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved