IOS开发之微博的设计与实现

//
//  main.m
//  Microblog
//


#import <Foundation/Foundation.h>
#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 <Foundation/Foundation.h>

@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 <Foundation/Foundation.h>
@implementation Person

-(void)showName
{
    NSLog(@"打印人的名字");
    //NSLog(@"%@",_name);
}

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

#import <Foundation/Foundation.h>
#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
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值