While it is possible to access static
members from a class instance, it’s bad form, and considered by most to be misleading
because it implies to the readers of your code that there’s an instance of the member per class instance.
Noncompliant code example
class MyClass {
public :
static void Mymethod() {
// ...
}
};
MyClass* pmyclass = new MyClass();
pmyclass->Mymethod(); // Noncompliant
Compliant solution
class MyClass {
public :
static Mymethod() {
// ...
}
};
Myclass::Mymethod();