add solution for hw8
This commit is contained in:
35
hws/youtube_comments/comment.cpp
Normal file
35
hws/youtube_comments/comment.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "comment.h"
|
||||
|
||||
// Constructor
|
||||
Comment::Comment(std::string vid_id, std::string auth, std::string comm_id, int likes,
|
||||
int replies, bool isReply, std::string parent_id, std::string pub_date,
|
||||
std::string crawl_date, bool isOwner, std::string comm) {
|
||||
video_id = vid_id;
|
||||
author = auth;
|
||||
comment_id = comm_id;
|
||||
like_count = likes;
|
||||
reply_count = replies;
|
||||
is_reply = isReply;
|
||||
parent_comment_id = parent_id;
|
||||
published_date = pub_date;
|
||||
crawled_date = crawl_date;
|
||||
is_video_owner = isOwner;
|
||||
comment = comm;
|
||||
}
|
||||
|
||||
// Destructor - clean up all children
|
||||
Comment::~Comment() {
|
||||
for (size_t i = 0; i < children.size(); ++i) {
|
||||
delete children[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Add a child comment to this comment
|
||||
void Comment::addChild(Comment* child) {
|
||||
children.push_back(child);
|
||||
}
|
||||
|
||||
// Like this comment
|
||||
void Comment::like() {
|
||||
like_count++;
|
||||
}
|
||||
Reference in New Issue
Block a user