MISRA Discussion Forums

Full Version: 11.0.1 and static data members
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Does 11.0.1 "Member data in non-POD class types shall be private." apply to all data members, or only non-static data members?

In particular, I'm interested whether the constant in this code violates 11.0.1:

Code:
class MyClass {
    std::string non_pod_class;
public:
    static const int CONSTANT = 10;
};

const int MyClass::CONSTANT;
This rule applies to all data members, including statics