class Yellow Pages public Yellow Pages public string
� class Yellow. Pages { // ���������� public Yellow. Pages() { // �����. . . } public string[] Search(string name) { // ��������� return ……; } }
� Search. Button_Click() { Yellow. Pages yp = new Yellow. Pages(); string[] result = yp. Search(text. Box 1. Text); for(int i = 0; i < result. Length; i++) list. Box 1. Items. Add(result[i]); }
� Search. Button_Click() { // Yellow. Pages yp = new Yellow. Pages(); // string[] result = yp. Search(text. Box 1. Text); string[] result = {“nancy - 081 xx”, “lula – 089 xx”}; for(int i = 0; i < result. Length; i++) list. Box 1. Items. Add(result[i]); }
3. ������ Search. Button_Click() { Form 2 info = new Form 2(); Form 1 Form 2 info. Show(); info. Display. Info(“���� ”); } public void Display. Info(string name) { // do something }
ทบทวน: Object is pass-by-reference class Hero { public int HP; . . . } Hero skel. King = new Hero(); skel. King. HP = 100; Storm. Seeker(skel. King); skel. King. HP = ? ? void Storm. Seeker(Hero x) { x. HP = x. HP - 200; }
4. ���� • 2 �� 1 ����� Chat Client Demonstration!
Chat Server Chat Client Chat. API. Get. Message() Chat. API. Post. Message()
Chat. API. Get. Message(); • คนคาเปน array ��� 20 ������ • 1 string = 1 ������� string[] msgs = Chat. API. Get. Message(); msgs[0] == "118>nattster>�������� " msgs[1] == "119>nattster>������ Chatroom Client" msgs[2] == "120>b 4 lmung>������ maid guy" msgs[3] == "121>nattster>@b 4 lmung �� maidguy ���� : P …
list. Box 1 � User. List Update(List. Box ulist). . . text. Box 1 � Chat. Box ���� 2 ������ Update(Text. Box mtext). . .
class Chat. Box { public void Update(Text. Box mtext) { mtext. Text = “�������� ”; } }
- Slides: 27