Say I have:
class A {
public:
static void DoStuff();
// ... more methods here ...
};
And later on I have a function that wants to
It's better to call the static method by its name, not through an object, since it doesn't actually use that object at all. In Java, the same problem exists. A not-too-uncommon problem in Java is the following:
Thread t = getSomeOtherThread();
t.sleep(1000);
This compiles fine but is almost always an error -- Thread.sleep() is a static method that causes the current thread to sleep, not the thread being acted on as the code seems to imply.