QtDesignPatterns/mediatorpattern/usr.h

27 lines
422 B
C
Raw Permalink Normal View History

2024-02-06 17:21:37 +08:00
#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;
};