In the interest of code clarity, ``++static++`` member variables of a base class should never be accessed using a derived type's name. Doing so is confusing and could create the illusion that two different static variables exist. If the variable is ``++const++``, there is no risk of confusion.

== Noncompliant Code Example

----
class Parent {
  public:
    static int count;
    static Color const defaultColor = green;
};

class Child : public Parent {
  public:
    Child() : myColor(Child::defaultColor) // Compliant, this is a constant
    {
      Child::count++;  // Noncompliant
    }
};
----

== Compliant Solution

----
class Parent {
  public:
    static int count;
    static Color const defaultColor = green;
};

class Child : public Parent {
  public:
    Child() : myColor(Child::defaultColor) // Compliant, this is a constant 
    {
      Parent::count++;
    }
};
----

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

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