题目
/**
1. 说说类
* 文字内容
* 图片
* 发表时间
* 作者
* 转发的说说
* 评论数
* 转发数
* 点赞数
作者
- 名称
- 生日
- 账号
账号
- 账号名称
- 账号密码
- 账号注册时间
模拟场景:
- 张三在2007-9-8 17:56:34的时候, 注册了一个账号(名称:itcast, 密码:123456)
- 张三的生日是1998-7-4 18:46:24
- 张三在2010-8-8 9:23:44的时候, 发布一条说说
- 文字内容 @“今天心情不错”
- 图片 @“test.png”
- 发表时间
- 作者
- 转发的说说
- 评论数 100
- 转发数 290
点赞数 2000
李四在2006-9-8 19:26:54的时候, 注册了一个账号(名称:lisiitcast, 密码:654321)
- 李四的生日是1999-9-6 14:16:28
- 李四在2011-8-8 20:47:09的时候, 转发了张三之前发布的说说, 并且还附带了一句话:@“今天心情确实不错”
*/
blog.h
#ifndef blog_h
#define blog_h
#import <Foundation/Foundation.h>
//账号类
@interface CzxxAcc: NSObject
{
@private
NSString * _accName;
NSString * _accPassword;
NSString * _accRegTime;
}
@property (nonatomic,copy) NSString * accName;
@property (nonatomic,copy) NSString * accPassword;
@property (nonatomic,copy) NSString * accRegTime;
-(id)initWithAccName:(NSString *) pAccname
andPass:(NSString *) accPass
andRegTime:(NSString *) Time;
@end
//作者类
@interface CzxxAuthor: NSObject
{
@private
NSString * _name;
NSString * _birth;
CzxxAcc * _account;
}
@property (nonatomic,copy) NSString * name;
@property (nonatomic,copy) NSString * birth;
@property (nonatomic,strong) CzxxAcc * account;
@end
//说说类
@interface CzxxQzone: NSObject
{
@private
NSString * _blogContents;
NSString * _blogPics;
NSString * _blogSendTime;
CzxxAuthor * _blogAuthor;
CzxxQzone * _blogCopy;
int _commentsNums;
int _copyNums;
int _likeNums;
}
@property (nonatomic,copy) NSString * blogContents;
@property (nonatomic,copy) NSString * blogPics;
@property (nonatomic,copy) NSString * blogSendTime;
@property (nonatomic,strong) CzxxAuthor * blogAuthor;
@property (nonatomic,strong) CzxxQzone * blogCopy;
@property (nonatomic,assign) int commentsNums;
@property (nonatomic,assign) int copyNums;
@property (nonatomic,assign) int likeNums;
-(NSString *)description;
@end
#endif /* blog_h */
blog.m
#import <Foundation/Foundation.h>
#import "blog.h"
@implementation CzxxAcc
-(id)initWithAccName:(NSString *) pAccname
andPass:(NSString *) accPass
andRegTime:(NSString *) Time
{
if(self = [super init])
{
self.accName = pAccname;
self.accPassword = accPass;
self.accRegTime = Time;
}
return self;
}
@end
@implementation CzxxAuthor
@end
@implementation CzxxQzone
@synthesize blogContents = _blogContents;
@synthesize blogPics = _blogPics;
@synthesize blogSendTime = _blogSendTime;
@synthesize blogAuthor = _blogAuthor;
@synthesize blogCopy = _blogCopy;
@synthesize commentsNums = _commentsNums;
@synthesize copyNums = _copyNums;
-(NSString *)description
{
NSString * str = [NSString stringWithFormat:@"blogContents is %@\n andPic is%@ \n and sendTime is %@\n and andAuthName is %@\n and AuthBirth is %@\n AccName is %@\n and AccPass is %@ and accRegTime is%@ andblogCopy conTent is%@ and Copy from %@\n",_blogContents,_blogPics,_blogSendTime,_blogAuthor.name,_blogAuthor.birth,_blogAuthor.account.accName,_blogAuthor.account.accPassword,_blogAuthor.account.accRegTime,_blogCopy.blogContents,_blogCopy.blogAuthor.name];
return str;
}
@end
main.m
#import <Foundation/Foundation.h>
#import "blog.h"
int main(int argc, const char * argv[]) {
@autoreleasepool {
// insert code here...
CzxxAcc * acc_zhangsan = [[CzxxAcc alloc] initWithAccName:@"itcast" andPass:@"123456" andRegTime:@"2007-9-8 17£∫56£∫34" ];
CzxxAuthor * auth_zhangsan = [[CzxxAuthor alloc] init];
auth_zhangsan.name = @"张三˝";
auth_zhangsan.birth = @"11998-7-4 18:46:24";
auth_zhangsan.account = acc_zhangsan;
CzxxQzone * blog_zhangsan = [[CzxxQzone alloc] init];
blog_zhangsan.blogContents = @"今天心情不错";
blog_zhangsan.blogPics = @"test.png";
blog_zhangsan.blogSendTime = @"2010-8-8 9:23:44";
blog_zhangsan.blogAuthor = auth_zhangsan;
blog_zhangsan.blogCopy = nil;
blog_zhangsan.commentsNums = 100;
blog_zhangsan.copyNums = 290;
blog_zhangsan.likeNums = 2000;
NSLog(@"%@",blog_zhangsan);
CzxxAcc * acc_lishi = [[CzxxAcc alloc] initWithAccName:@"lisiitcast" andPass:@"654321" andRegTime:@"2006-9-8 19£∫26£∫54" ];
CzxxAuthor *author_lishi = [[CzxxAuthor alloc] init];
author_lishi.name = @"李四";
author_lishi.birth = @"1999-9-6 14:16:28";
author_lishi.account = acc_lishi;
CzxxQzone * blog_lishi = [[CzxxQzone alloc] init];
blog_lishi.blogContents = @"今天确实心情不错";
blog_lishi.blogPics = nil;
blog_lishi.blogSendTime = @"2011-8-8 20:47:09";
blog_lishi.blogAuthor = author_lishi;
blog_lishi.blogCopy = blog_zhangsan;//ƒø«∞√ª”–◊™∑¢
blog_lishi.commentsNums = 0;
blog_lishi.copyNums = 0;
blog_lishi.likeNums = 0;
NSLog(@"%@",blog_lishi);
}
return 0;
}
模拟社交平台信息发布与交互
本文通过模拟社交平台场景,展示了用户张三发布的一条包含文字和图片的内容及互动情况,随后用户李四对该内容进行了转发并添加了自己的评论。文章详细记录了用户的账号信息、发布内容的时间、形式及互动数据。
77

被折叠的 条评论
为什么被折叠?



