����͡Ẻ���������

    㹡�����ҧ�к����� �ش��� � ���� � ������¤����ӹ֧�֧㹡���͡Ẻ�к��Ҩ���觼�������µ���к�   ���ҧ�ҡ��������ѧ �ѧ������ǹ���Т��йӨء�Դ��Ҵ��� � ���� � ������¤����ӹ֧�֧㹡�����ҧ�к� �ѧ���

Document ��� Comment

        ������������ǡѺ���������� �����͡��ú͡�֧�Ըա����ѭ�ҷ���Ҩ���Դ�����Ѻ�������������     ��駹�����ͻ�ͧ�ѹ��üԴ��Ҵ�ҡ�����ҹ��������Դ � �͡�ҡ��������ҧ��ǹ comment ������ǹ͸Ժ��  ������������鴢ͧ���������ö���㨡�÷ӧҹ������¢�� ���㹡�������������¹�ŧ��      ���������������ѧ������ö��������蹡ѹ

       ��ǹ�ͧ Document ��� Commint ������������ǹ�Ӥѭ���ТҴ�����㹡�����ҧ����������Ҩ�����ǹ��硹��� �������ö���»�ͧ�ѹ�����Դ��Ҵ���Ҩ���Դ��鹡Ѻ�к����ҡ

��� reuse

   �к����չ�鹤�����Ѻ����͡Ẻ�к������ҧ�� �����ѡ����Ӥѭ�ͧ������ҧ�ҹ�к����շ��Ҵ������� ��� reuse ���͡�ù��鴡�Ѻ�������������繵�ͧ���ҧ�鴢��������      

 

��õ�駪��� object

      ��õ�駪��� class,attribute ��� method �������ѡ��ä���� � �ѹ ��� 㹡�õ�駪������Ф��駹�鹤�äӹ֧�֧�ѡɳ�   ��÷ӧҹ���˹�ҷ��ͧ class ��� � ����ѡ ��������Ҽ�������ҹ��§���͡��è����֧˹�ҷ���÷ӧҹ�ͧ class  ����� �� class �����ӹdz�Ҥҹ���ѹ    ��õ�駪����� Cal_oil() ���� method �����Ǻ�������Դ-�Դ��е١��õ�駪����� sensor_door()

���� attribute �������ʶҹТͧ������ҡ��÷ӧҹ� metnod ���������� sum �繵�

   ��õ�駪��ͷ��� ��������Ҫ��ͷ���駹�鹷���������ѹ������ǡѺ˹�ҷ���÷ӧҹ ����á��������ҹ�����������ǡѺ��觷�� class ��鹷ӧҹ ��觫�͹������������

         �����ҡ�õ�駪��͹������§�ش��� � ���� � ��͡�����ҧ�к� ���ͧ�Դ����Ҷ���к�����բ�Ҵ�˭��ҡ �   �� class ������ � class ����ͨе�ͧ�ӡ��     ������ǹ˹�� �¼����ӡ�����ҧ�к����駪��ͷ������ʹ���ͧ�Ѻ��÷ӧҹ�ͧ object ������ �з�����Դ�����������ҡ��§��㹡���Ҩش�Դ��Ҵ���ͷӡ����� ���ͻ�Ѻ��ا�к�

 

�鴷�����¡�ҡ�������ѡ

        ����͡Ẻ�к��������ǡѺ����������ŷ���������ö����¹�ŧ�� ������ǹ�����Թ����������͡Ѻ hardware �ѧ�����ǹ�ͧ�鴴ѧ����Ǩ֧����¡�͡ class ��������к�

 ������ҧ�� �����¹�������������͡Ѻ serial port ���� port ��ҧ � ���ͤ����дǡ�֧������ҧ class ����˹�ҷ��㹡���������������ҧ hardware ��੾�� ������¡����� wrapper class �� class ��� � ���зӡ�õԴ��� �Ѻ serial port �е�ͧ�� message 价�� wrapper class

�������ǹ㹡���Ѻ���ͺ�ԡ�â����ŷ�� class ��蹵�ͧ������ͷӡ���ŧ����������觵����ѧ serial port �ա��˹��

         ���㹡óշ�������к�价ӧҹ�� hardware ��� ����§������¹���ǹ�ͧ wrapper class ��ҹ�� �������з���͡�÷ӧҹ�ͧ��������

�ӡѴ�ͺࢵ attribute �����·���ش

       㹡�����ҧ������������ա�äǺ������ǹ�ͧ attribute �ѡ���Դ�ѭ�ҵ����������к����ͧ�ҡ��ǹ attribute ���������繵�Ǻ͡ʶҹТͧ�к� �ѧ��鹶�һ��������ա����Ҷ֧ attribute ���ҧ����Шз�����äǺ��� ���͡������к������ҡ�ҡ

        ��èӡѴ�ͺࢵ attribute �����·���ش��� �ٻẺ�����¹��������շ���ش

������ҧ�蹶���� method ˹�� ��觵�ͧ��� attribute �����纤����§���Ǥ��� ���� method �ѧ�괴�ҹ��ҧ

  public class Math {

               int temp = 0;

               public int swap (int a ,int b)  {

                              temp =a;

                              a=b ;

                               b = temp ;

                                   return temp ;

                 }

     }

�ѭ�Ңͧ�괴�ҹ����� attribute temp ���������� method swap() ��ҹ�� �ѧ��鹨֧��û�С�� attribute temp ��������� method swap() ��ҹ��

     public class Math {

            public int swap (int a,int b) {

                         int temp = 0 ;

                          temp = a ;

                           a=b ;

                            b = temp ;

                            return temp ;

                  }

       }  

 

    �ش�Դ��Ҵ����Ҩ���Դ���

             �ش�Դ��Ҵ ���� error ����Ҩ���Դ����麹�������� �������������ͧ���� ���ͧ�ҡ������ҧ��������      ���������ѡ���դ����Դ��Ҵ�Դ���       ���� ����Ѻ�������������ջ��ʺ��ó�㹡����¹����� ���� �Ҩ����������ͧ��õ�Ǩ�ͺ��ͧ�Դ��Ҵ����Ҩ ���Դ������� ���㹺ҧ���� �Ҩ������к����������

    

              Page1 >>> Page 2 >>> Page3 >>> Home


                                                                      Coppyright 2004 By Webmaster All Right Reserved Comments

Hosted by www.Geocities.ws

1