The difference between ``++private++`` and ``++protected++`` visibility is that child classes can see and use ``++protected++`` members, but they cannot see ``++private++`` ones. Since a ``++final++`` class will have no children, marking the members of a ``++final++`` class ``++protected++`` is confusingly pointless.

== Noncompliant Code Example

----
class C final {
protected:  // Noncompliant
  void fun();
};
----

== Compliant Solution

----
class C final {
private:
  void fun();
};
----

== Exceptions

When overriding a base class function, it is common practice to keep the same visibility as for the base class. This rule ignores ``++protected++`` functions in a ``++final++`` class that are overrides of a base class ``++protected++`` function.

ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
