I have two classes Plugin and Display and Display inherits from Plugin. Plugin can't call a static Display method, how can I solve this? The Display class works fine elsewhere, and this all works fine with the line commented out.
#ifndef PLUGIN_H
#define PLUGIN_H
//#include "Display.h" // don't include this here
#include "Data.h"
class Plugin
{
public:
typedefvoid (*ptrToFunction)();
virtual ptrToFunction getRenderPointer() = 0;
virtualvoid editData(Data* data) = 0;
void drawGraph();
// { // don't inline this here
// Display::renderPointsGraph();
// }
};
/*
Now that Plugin is fully defined, it is OK to include Display.h
*/
#include "Display.h"
inlinevoid Plugin::drawGraph() // now we can inline this
{
Display::renderPointsGraph();
}
#endif
Thanks for the reply. I tried your plugin fix but I am still getting the same errors. "'Display': is not a class or namespace name". "'renderPointsGraph': identifier not found".
No Data.h doesn't include any of them. It is included in another .cpp file, but that's so I can access one of Display's static functions. How else am I supposed to do that without including the header in the file?
well using names like Display, Plugin, and Data without surrounding/protecting namespaces are generally no good idea since it could be defined elsewhere.
if a line like #define Display whatever exists you're lost.
I'd suggest that you rename your Display to don't know maybe xxxxDisplay (all other accordingly) and see what happens