, , . ++ . , A:
class A {
public:
int Method1() { return 1; }
int Method2() { return 2; }
int Method3() { return 3; }
int Method4() { return 4; }
int Method5() { return 5; }
};
B, ( , B A, B).
class B: private A {
public:
using A::Method1;
using A::Method2;
using A::Method3;
};
C, :
class C: private A {
public:
using A::Method4;
using A::Method5;
};
, C, , :
class C: public A {
public:
};
:
B *b = new B();
b->Method1();
b->Method4();
, , , , B A:
A *brokena = b;
A *a = (A*)b;
a->Method4();