���� ������
�������� ������ ������ � �������� � ��������� � PHP 5. ������� ��������� ����������� ��������� ������ � PHP 5: ������������ ������� ��������� (private, public, protected), ������������, ���������, ������������, ����������� ������ (__clone, __construct)
�������� ������
��������� ��������� ������ �������, ��������� ���������# | ������� |
---|---|
1 |
������� ����� NotePad, ����������
|
2 | ������� ��������� $note1 ������ NotePad. ������� ����� note_show. ������� �������� TEXT_SIZE ��� ������������� ������ note_show |
3 | �������� � ����� �����������, ����������� ��� ��������� � ��������������� �������� ������� $phone, $name � $surname ��������������. ������� ��������� $note2 ������ NotePad. ������� �������� ������� ������ � ������� ������ note_show |
4 | ���������� ����� __clone() ���, ����� ��� ������������ �������� ������� $phone, $name, $surname ����������. ������� ����� $note2_copy ������� $note2. ������� ����� note_show ��� ������� $note2_copy |
5 |
������� ����� NoteChild, ����������� NotePad. � ������ NoteChild �������������� ����� note_show ��������� �������: �) note_show ������� ��� �������� ������ (��. ����� ���������������� �������� magic constants); a) note_show ������� ������ "����� ������������� ������ note_show ..."; �) �������� ����� note_show �������������� ������ |
6 | ������� ������ $child1 ������ NoteChild. ������� ����� note_show. ������� ����� $child1_copy ������� $child1. ������� �������� ������� $phone, $name, $surname ��� ������� $child1_copy |
7 |
�������� � ����� NoteChild ����� cut_note, ������� �������� ��������� �������� ������� $phone, $name, $surname ��
������������ �����, ����������� ��������� ��������� TEXT_SIZE. ������� ������ $child2 ������ NoteChild � �������
��� ���� ����� cut_note. ������� �������� ������� $phone, $name, $surname ��� ������� $child2. ����� �������� ������ ����� ������������ ������� ��� �������������� ����� mb_substr ��� mb_strcut, ��������� �������� ��������� "UTF-8". �������� �������� �� ������ ��� ��������� � �������� (private) �������� $phone. �������� ����������� ������� ��������� ��� $phone, ����� �������� ������. |