�����2. �ԸդԴẺ Object ���� 2
����ᵡ��ҧ�����ҧ Interface ��� Implement
����͡Ẻ�ҧ Object-Oriented ��鹨�����Ǣ�ͧ�Ѻ��觷�����ѵ�� (Object) ��Ше�ͧ������ͧ�ͧ Encapsulate ���������Ǣ�ͧ ���ͷ��л���ͧ data ��������� user ���� programmer ��Ҷ֧�� �ѧ��鹡����֡�ҡ�кǹ����͡Ẻ���� �֧���繵�ͧ��Һ�֧����ᵡ��ҧ�ͧ Interface ��� Implement ���¡�
�ҡ������ҧ������¡���Ƕ֧����㹺���� 1 �֧����ͧ�ͧ�һ�駢���ѧ����ç�ҹ��Ե俿�� ��� interface �ͧ������ҧ����� �����º����� ���ͧ�ҡ��кǹ��÷��������Դ��� ������ա����ҹ�����º����� (Interface) ���ҧ�١��ͧ �͡�ҡ�����ǹ�ͧ�һ�駢���ѧ ����� object ��¹͡�������繵�ͧ��Һ�֧����Ңͧ��кǹ��ü�Ե俿�� ��§�����֧�Ը����ҹ interface ����§��
�ա������ҧ˹���� ��кǹ��÷ӧҹ�ͧö¹�� ����� interface �����ҧ���Ѻ���ö��� �ѹ���, �á, �ǧ����� ���ͧ�ҡ����ǹ�˭� ��ʹ�����ǡѺ��觷������� ������������ �ѧ��鹡�÷��ö������� �֧��ͧ����ǡѺ��� start ö, �ѹ��� ����á ��������觷����������͡�ҡ������ǡ���� interface�����ҧ�١��ͧ��ҹ�鹨֧�Դ����ª�� �� ���Ѻ��è������Ҿǧ�������ҹ�����ҧ�����ǹ���Ѻ���������㹵������ͧ�ѡ÷����һ�Сͺ��ö¹���� ����ѹ�Һ�ͧ����ͧ, ��ǹ�ͧ���������ͧ �������俷���§�������㹵��ö �������ǹ��褹�Ѻö��ǹ�˭�����Һ ��������繵�ͧ��Һ ����ҹ������ǹ������¡��� implement ����ѧࡵ�ա���ҧ˹�觤�� 㹡������¹�ŧ��ǹ�ͧ interface �ѡ���ռš�з���ͼ�������� �� �������¹�ҡ�ǧ�����ö��繡���� Joystick ᷹ ����Ҥ��Ѻö����������������Ѻ�������¹�ŧ㹤��駹�� ��㹷ҧ��Ѻ�ѹ ��Ҽ���͡Ẻ�к��ӡ������¹�ŧ��ǹ�ͧ implement �ѡ������ռš�з���ͼ���� �� �������¹�ҡ ����ͧ¹�� 4 �١�ٺ�������ͧ¹�� 8 �١�ٺ �������觼� ��з���͡��� ��ҹ�ͧ���Ѻö¹�� ���Ѻö¹�����仡������Ѻ��
Interface
Interface ��͡�ú�ԡ�÷���ʴ���� user ���Ըա�á�˹� interface ����� user ����繼�����鹤�èС�˹� �з����繵�͡����ҹ��Ф�����ͧ��âͧ user ��ҹ�� �����Ҥ�����ͧ��âͧ user ���Ф�����������ѹ ���� ¡������ҧ�� �ó��һ�駢���ѧ����ç�ҹ ��Ե俿�� ���÷�� user �з�Һ���վ�§������º���꡷���� interface ��ҹ��
Implement
Implement �����������´������������� interface �������ö����¹�ŧ���� interface �ѧ���������� ��з���͡�÷ӧҹ�ͧ user �� �óբͧ�һ�駢���ѧ����ç�ҹ��Ե俿��������о�����������ç�ҹ��Ե俿�Ҩ�����¹��÷ӧҹ�ҡ������ҹ�Թ��Ե俿����������������᷹俿�ҷ���Ե�͡�� ������ö��ҹ��ҹ������º���� (interface) ������� ����㹡óշ��зӡ������¹�ŧ�ҡ��ü�Ե俿�ҡ���ʵç��繡������Ѻ ����觼ŵ�͡�÷ӧҹ�ͧ interface ���ҧ�� ����������Դ�ѭ�ҵ���к��蹡ѹ
������ҧ�ͧ interface/implement
¡������ҧ�����ʴ�����ᵡ��ҧ�����ҧ interface ��� implement ���������ҧ�Ѵਹ�ҡ��÷ӧҹ��ԧ�ͧ�к��ҹ������ ��㹺���ѷ���˹�觷�����к��ҹ�����ŷ���� Oracle �ҹ�����ū��㹡�����ҧ��ǹ interface ����� user (programmer) ����á�����Ѳ�����ͼ��ӡ���͡Ẻ�к��е�ͧ��Һ��� ������Ǩ������ͧ��âͧ user ��зӡ��������������ǹ interface �����������Ѻ�����ҹ�ͧ user ���ҧ���ԧ user ��ͼ����ҹ �ѧ�����觷�� user ��ͧ��� (�����ء���ҧ) �֧����觷�������ҧ �ҡ������ҧ�������ö���ҧ��ǹ interface ��ѧ���
- ��ͧ����ö�Դ����������Ͱҹ��������
-��ͧ����ö�Դ����������Ͱҹ��������
-��ͧ����ö���� cursor (�١�ê��) ��ѧ���˹��á�ͧ�ҹ��������
-��ͧ����ö���� cursor (�١�ê��) ��ѧ���˹��ش���¢ͧ�ҹ��������
-��ͧ����ö�Ҩӹǹ record 㹰ҹ��������
-��ͧ����ö��˹������ record �����ҡ����麹 darabase
-��ͧ����ö���� cursor 仺� record �� ��������������
-��ͧ����ö�Ӣ������ record ����ҹ��������������
-��ͧ����ö��ѧ recird �Ѵ� �ҡ���˹� cursor �����
|
Database |
|
+open : void +close : void +goToFirst : void +howManyRecord : int +areThereMoreRecords : boolean +positionRecordRecord : void +getRecord : String +getNextRecord : String
|
㹡���͡Ẻ�к���äӹ֧�֧����ͧ�ͧ ��� reuse ���� ���ͧ�ҡ���繻���ª�����ҧ�ҡ��͡�þѲ���к�����
�ҹ�����ŷ�������¡�繵�����ҧ��� ������к���ԧ� ����������ǹ�ͧ method ��� attribute �ҡ��� ��� ���˹觢ͧ programmer ���������繵�ͧ��Һ���ǹ�ͧ private method ��� attribute ����ҹ�� �� ������ ��ͧ��Һ������ method ������ç���ҧ���ҧ�è֧���������ö��¹������������Ͱҹ �������� ���ͷ� ���ҧ�è֧���Դ�ҹ������ file �� �繵� ����㹵��˹觢ͧ����ҹ ��§�����ҷ����ҧ�è֧�еԴ��͡Ѻ (public method) �����§������
�ҹ�����ŷ��¡������ҧ��� ������к���ԧ� ��������ǹ�ͧ method ��� attribute �ҡ��� ��㹵��˹觢ͧ���������� ���������繵�ͧ��Һ���ǹ�ͧ private method ��������繵�ͧ��Һ���ҹ� method ������ç���ҧ���ҧ�è֧���������ö��¹������Դ��Ͱҹ�������� ����㹵��˹觢ͧ�����ҹ ��§�����ҷ����ҧ�è֧�еԴ��͡Ѻ interface �����§������
�ҡ��ͨӡѴ��ҧ�� ����ö�ִ����Ҵ������ҧ�괴�ҹ��ҧ���
|
public void open (String Name) { /*application.... .... ���¡�� Oracle API 㹡���������Ͱҹ������ application.. .. .. .. */ } |
������ҧ������ Oracle API 㹡���������Ͱҹ������
|
public void open (string Name) { /*application.. .. .. .. ���¡�� SQL API 㹡�����͵�Ͱҹ������ application .. .. .. .. */ } |
��ǹ������ҧ��� ���� SQL API 㹡���������Ͱҹ������
Coppyright 2004 By Webmaster All Right Reserved Comments