Question
Complete User.cpp C++ User.cpp #include #include #include User.h User::User(string name){ } /** Create a pointer to a post (use new) [example: Post* q = new
Complete User.cpp C++
User.cpp
#include
#include
#include "User.h"
User::User(string name){
}
/** Create a pointer to a post (use "new") [example: Post* q = new Post("Homework","Thu Sep 12 2018");]
and then add it to the linked list (create a new node, etc)
You have already implemented the queue in the class, you know!
*/
void User::addPost(string value,string time){
}
/**Using the head_posts, you can go through the posts and print them out (cout)
you should print them out like this:
"username" wrote "content of the post" at "time of the post"
For example
Jose wrote I am a great programmer at Thu Aug 30 14:23 2018.
*/
void User::showPosts(){
}
User.h
#ifndef USER_H
#define USER_H
#include
#include "Post.h"
using namespace std;
class User
{
public:
//This Node class is used for linked list that keep posts
class Node {
public:
Post* p;
Node* next;
};
User(string name);
/** Create a pointer to a post (use "new") [example: Post* q = new Post("Homework","Thu Sep 12 2018");]
and then add it to the linked list (create a new node, etc)
You have already implemented the queue in the class, you know!
*/
void addPost(string value,string time);
/**Using the head_posts, you can go through the posts and print them out (cout)
you should print them out like this:
"username" wrote "content of the post" at "time of the post"
For example
Jose wrote I am a great programmer at Thu Aug 30 14:23 2018.
*/
void showPosts();
private:
string name;
Node* head_posts;
Node* tail_posts;
int numberOfPosts;
};
#endif
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started