Say I have:
class A {
public:
static void DoStuff();
// ... more methods here ...
};
And later on I have a function that wants to call DoStuff:
B::SomeFunction(A* a_ptr) {
Is it better to say:
a_ptr->DoStuff();
}
Or is the following better even though I have an instance pointer:
A::DoStuff()
}
This is purely a matter of style, but I'd like to get some informed opinions before I make a decision.
Although I agree that A::DoStuff() is clearer, and it's what I'd write myself, I can see an argument for going via the pointer, which is "suppose the class name changes". If class A becomes class B, then we only need to update the class name in one place (the pointer declaration) instead of two.
Just a thought...