3
class A: public L /->A->L
4
class B: public L C-->B->L
5
class C: public A, public B
6
������� ��� ������� L, ������������:
7
A::L::method, B::L::method
9
class A: virtual public L /->A-\
10
class B: virtual public L C-->B->L
13
�������� ����������� �������������:
18
2. Private inheritance can be used to eleminate ambiguity in such case, for
20
B: A ; C: A ; D: public B, private C
21
When accessing baseclass A from external classes, acess will go in the
22
way "D::B::A" automatically.
24
3. � ��� ����� ������ ����� ����� "using A::f" ( �� ������������� �� ����������,
25
�� ����� ����� ���������� �������� ����� �����-��������� c.C::f()
29
class D: B { f(char*} }
30
D *pd->f(1) - ���� ��� ������, � �� ���������
33
5. �� ������������ ���������� �� ������������� ������, � ������ ����� ������.
34
class A{}; class B : A {}; class C : B{}; c = new C;
35
For example, if the constructor for "B" calls a virtual function, it will
36
invoke a version defined for "B" or "A" , but not one from "C". At that point
37
of construction, the object isnt yet a "C" ; it is merely a partially
38
constructed object. It is best to avoid calling virtual functions during
39
construction and destruction.
41
6. If the delete constroctur is overrided in the base class, the destructor (at
42
least abstract one) should be declared as well. Otherwise, the invalid size
43
would be passed to delete(void*, size_t) operator.