1class base
2{
3 public:
4 int x;
5 protected:
6 int y;
7 private:
8 int z;
9};
10
11class publicDerived: public base
12{
13 // x is public
14 // y is protected
15 // z is not accessible from publicDerived
16};
17
18class protectedDerived: protected base
19{
20 // x is protected
21 // y is protected
22 // z is not accessible from protectedDerived
23};
24
25class privateDerived: private base
26{
27 // x is private
28 // y is private
29 // z is not accessible from privateDerived
30}
31