QtDesignPatterns/mediatorpattern/usr.h

27 lines
422 B
C++

#include "chatroom.h"
class User
{
public:
User(string name) : name(name)
{
cout << "init user " + name << endl;
}
string getName()
{
return this->name;
}
void setName(string name)
{
this->name = name;
}
void showMessage(string message)
{
ChatRoom chatRoom;
chatRoom.showMessage(this->name, message);
}
private:
string name;
};