142 bilgisayar programlama ii (c/c++) - gazi...

Post on 07-Feb-2018

226 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

����142 Bilgisayar Programlama II (C/C++)

� ������� �� ����������

� ���������������

���������� �������� ���!�" �

#��$�

� � ��%� const &���������const ����'���������

� ���%��" � �&��������(����������) ����#$���" �� friend '�������������friend (���*�

� this +������#$���" �

� new ���delete ���,���" ���� �-����.!����" �

� static (���������

2

3

� ��%

� const ������������const������� ������������ �� ��������������������� ������

� this���������������������static �� � �������������������� �� ��

� new ���delete��� ����������� ���� ��� ����������� �� ��

#��$�

� � ��%� const &���������const ����'���������

� ���%��" � �&��������(����������) ����#$���" �� friend '�������������friend (���*�

� this +������#$���" �

� new ���delete ���,���" ���� �-����.!����" �

� static (���������

3

5

const &���������const ����'���������

� � ���������������������������������� ����� ��� const ������������������������������ � �����������

� ����������� ����� ���� ���� ����� ����������������� !!��������"����const�������� ��������������� ��const � ���� �� � ��� ������ ��� �������������

6

const &���������const ����'���������

4

7

const &���������const ����'���������

8

const &���������const ����'���������

5

9

const &���������const ����'���������

10

const &���������const ����'���������

6

11

const &���������const ����'���������

� #���� � ��������������������� ���������� $���� ��� � �� �� ��� ������

� ����� � ����������������� ���� � ��������������������� ��������� ��� � �� �� ���� ������ ����

� %����������� ������"�����"���� � ����������������������� � �����&'(� � ���� ����� ����

� %����������� ��������������� � ������������������&)(����� ���������� � � ��� �&*(�������

� +���� � ������� ���� ����� �� � �����&,�-(��������� �� ������������ � ����

� ����� � ����������� ����������&.(����������� � � �� � �������

12

const &���������const ����'���������

7

13

const &���������const ����'���������

14

const &���������const ����'���������

8

15

const &���������const ����'���������

� const��������= ���� � � �"������� � ���������

� const��������= ���� � � �"������� � ���������

#��$�

� � ��%� const &���������const ����'���������

� ���%��" � �&��������(����������) ����#$���" �� friend '�������������friend (���*�

� this +������#$���" �

� new ���delete ���,���" ���� �-����.!����" �

� static (���������

9

17

���%��" � �&��������(����������) ����#$���" �

� ����������� � �����"� ��������������� � ���� ��� ��������������������� ��� ������������,�����������-�������

� /�����������AlarmClock"� ���������Time ������������� � ������

� AlarmClok"� ������������������������� ����� �Time�������������������������������� ����

18

���%��" � �&��������(����������) ����#$���" �

10

19

���%��" � �&��������(����������) ����#$���" �

20

���%��" � �&��������(����������) ����#$���" �

���������������� ������

11

21

���%��" � �&��������(����������) ����#$���" �

22

���%��" � �&��������(����������) ����#$���" �

� ������� ����������dateOfBirth��birthDate�� �������� ��dataOfHire ���hireDate �� �������� ���� ���������

���������������������

12

23

���%��" � �&��������(����������) ����#$���" �

24

���%��" � �&��������(����������) ����#$���" �

������ ������� �� �������������������������������������� �������� ���� ���������

13

#��$�

� � ��%� const &���������const ����'���������

� ���%��" � �&��������(����������) ����#$���" �� friend '�������������friend (���*�

� this +������#$���" �

� new ���delete ���,���" ���� �-����.!����" �

� static (���������

26

friend '�������������friend (���*�

� �������������� �"� ���� � �����"� �������"����������� �� ���� �������"� �������������0�����"����������������������

� ClassOne������� � ��� ����� ������ �ClassTwoClassOne�� ��������� � �� ���� ����

� 1������������� ��"� ����������� ���� �� ��� �� �������������������������

� 1������� ���� � ���"� �������������� ��������������� ��� ������,���� ��*������"*�����"���-

14

27

friend '�������������friend (���*�

28

friend '�������������friend (���*�

15

29

friend '�������������friend (���*�

� 1�������� � ������������� ����� ����������������������

30

friend '�������������friend (���*�

� 1�������� � ������������� ����� ����������������������

16

#��$�

� � ��%� const &���������const ����'���������

� ���%��" � �&��������(����������) ����#$���" �� friend '�������������friend (���*�

� this +������#$���" �

� new ���delete ���,���" ���� �-����.!����" �

� static (���������

32

this +������#$���" �

� +��������������� � ������������������������������� � ������

17

33

this +������#$���" �

#��$�

� � ��%� const &���������const ����'���������

� ���%��" � �&��������(����������) ����#$���" �� friend '�������������friend (���*�

� this +������#$���" �

� new ���delete ���,���" ���� �-����.!����" �

� static (���������

18

35

new ���delete ���,���" ���� �-����.!����" �

� !!�new ���delete��� �������������� ���� ��� ������������� � �� �� ��

� new��� �������� ���� � �� ��� � ����� ������� delete��� ������ ��� � � ��������������� ���������������� ���� � �� ����� �����������

� 2� ��� �new ��� ���������timePtr������ ��� ������������ ����� � �� �������

� 2� ��� � ���� �������� �������

36

new ���delete ���,���" ���� �-����.!����" �

� 2� ��� ������*��������������������� ���� ���������������

19

#��$�

� � ��%� const &���������const ����'���������

� ���%��" � �&��������(����������) ����#$���" �� friend '�������������friend (���*�

� this +������#$���" �

� new ���delete ���,���" ���� �-����.!����" �

� static (���������

38

static (���������

� ��������������������������������������������������� ���������������

� static � � ��������������������������������������������� �������� �������

� static �������"� ����"��� �� �������� static �������public*�private ��� �protected� ���� � ������

� Static � � ���������� ��"�������������� ����������������

20

39

static (���������

��� ����������������������

��������������!� ����

40

static (���������

21

41

static (���������

!���� ���� ������ �����"� �#�!��������������

42

static (���������

22

43

static (���������

�������$�������"� ��������������� ��

���� �� ��������������#�!������������������

44

static (���������

top related