中介者模式 虛擬聊天室

2022-09-18 19:00:12 字數 1290 閱讀 5015

今天做了中介者模式---虛擬聊天室的實驗,用了差不多兩個小時的時間,理解了中介者模式的原理,下面是中介者模式的實驗要求和實現。

實驗要求:在「

虛擬聊天室

」例項中增加乙個新的具體聊天室類和乙個新的具體會員類,要求如下:

1. 新的具體聊天室中傳送的大小不得超過

20m。

2. 新的具體聊天室中傳送的文字長度不得超過

100個字元。

3. 新的具體會員類可以傳送資訊和文字資訊。

4. 新的具體會員類在傳送文字資訊時,可以在資訊後加上時間。

修改客戶端測試類,注意原有系統類**和客戶端**的修改。

截圖:

**:package 實驗19中介者模式;

import j**a.util.*;

public class group extends abcharroom

}public void sendtext(string a,string b,string c)

public void sendimage(string a,string b,string c)else}}

package 實驗19中介者模式;

import j**a.util.*;

public class group extends abcharroom

}public void sendtext(string a,string b,string c)

public void sendimage(string a,string b,string c)else}}

package 實驗19中介者模式;

public abstract class abcharroom

package 實驗19中介者模式;

public class main

}package 實驗19中介者模式;

public class pu extends member

public void sendtext(string a,string c)

public void sendimage(string a,string c)

}package 實驗19中介者模式;

public class xin extends member

public void sendtext(string a,string c)

public void sendimage(string a,string c)

}

mysql 聊天室 聊天室php mysql 六

聊天室php mysql 六 相應的 資料庫 phpmyadmin mysql dump 主機 localhost 3306 資料庫 study28 資料表的結構 chat user create table chat user userid varchar 20 not null,passwd v...

聊天室程式

伺服器 include include include include include include include include define servport 8081 伺服器端口號 define bufsize 200 最大傳輸量 int main int args,char argv s...

簡單聊天室

include include include include include include include include include include pthread t thread 2 void send msg void ip msg if connect sockfd,struct ...