access-specifier : member-specification
class X {
int a; // X::a is private by default: class used
public:
int b; // X::b is public
int c; // X::c is public
}; — end example
struct S {
int a; // S::a is public by default: struct used
protected:
int b; // S::b is protected
private:
int c; // S::c is private
public:
int d; // S::d is public
}; — end example
struct S {
class A;
enum E : int;
private:
class A { }; // error: cannot change access
enum E: int { e0 }; // error: cannot change access
}; — end example
class A { };
class B : private A { };
class C : public B {
A* p; // error: injected-class-name A is inaccessible
::A* q; // OK
}; — end example