I have a weird problem in C ++ code and I can't figure out what is going on. I know what a forward declaration is, and I know when to use them, etc.
However, in the C ++ project that I have, I am forced to declare a class that has already been declared in the included header. It looks something like this.
windows.h:
#ifndef WINDOWS_HH_ #define WINDOWS_HH_ #include "foo.h" class fooC;
and then foo.h contains the declaration of fooC
#ifndef FOO_HH_ #define FOO_HH_ class fooC { public: fooC(); ~fooC(); }; #endif
Any idea why this might happen? The actual code is part of a large project, and itβs really hard to understand what might be a mistake ... but I am sure, theoretically, that a direct declaration of fooC should not be necessary, is it?
Dan source share