I am working on a project and I am facing a little bit strange code which I cannot understand why and how can this happen !
I have a class Foo and Baz, and Foo has a non-static method that is called from Baz class without instantiating Foo:
class Foo {
public:
void qux(int a, int b);
};
class Baz {
public:
void bar(void);
};
void Baz::bar(void){
Foo::qux(2,3); // This should not happen as qux is not a static method !!
}
The only way that would work is if Baz
was derived from Foo
at some level.
Or, of course, Foo
bears a different meaning in that scope (via a using, typedef, define or other).
If neither apply, your compiler is seriously broken.