1class A
2{
3public:
4 int x;
5protected:
6 int y;
7private:
8 int z;
9};
10
11class B : public A
12{
13 // x is public
14 // y is protected
15 // z is not accessible from B
16};
17
18class C : protected A
19{
20 // x is protected
21 // y is protected
22 // z is not accessible from C
23};
24
25class D : private A // 'private' is default for classes
26{
27 // x is private
28 // y is private
29 // z is not accessible from D
30};