I have a problem with including header files in C++. As far as I know, it's not a good design to put using namespace std
inside header but I got some error when I try to remove it. Here is my code in header file :
#include <iostream>
#include <string>
//using namespace std;
class Messages
{
public:
Messages(string sender, string recipient,int time);
void append();
string to_string();
private:
int time;
string sender;
string recipient;
string text;
};
I did include <string>
. However, If I don't use namespace std, all my strings show errors. I do not want to add using namespace std
in header file because it's a bad design. So how do I fix it?
Thanks in advance.