#
Member declarations can be labeled by an access-specifier ([class.derived]):
access-specifier : member-specification
An access-specifier specifies the access rules for members following it until the end of the class or until another access-specifier is encountered.
[Example 1: 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]
Any number of access specifiers is allowed and no particular order is required.
[Example 2: 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]
When a member is redeclared within its class definition, the access specified at its redeclaration shall be the same as at its initial declaration.
[Example 3: struct S { class A; enum E : int; private: class A { }; / error: cannot change access enum E: int { e0 }; / error: cannot change access }; — end example]
[Note 1: 
In a derived class, the lookup of a base class name will find the injected-class-name instead of the name of the base class in the scope in which it was declared.
The injected-class-name might be less accessible than the name of the base class in the scope in which it was declared.
— end note]
[Example 4: class A { }; class B : private A { }; class C : public B { A* p; / error: injected-class-name A is inaccessible ::A* q; / OK }; — end example]

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant