Right, the coreRef template is exactly as above, now that I've changed the 'null' variable. I'll post the full code to that as well later if you want to see it, but the function declarations should be good. The problem comes with the following;
Abstract IGraphics class:
class IGraphics{ protected: static IGraphics* graphics; public: // use in the form "coreRef< IGraphics > grph = IGraphics::GetInterface< ConcreteGraphicsClass >();" template < class T > static coreRef< IGraphics > GetInterface(){ if( graphics == NULL ){ graphics = new T; } return coreRef< IGraphics >( graphics ); } /// Note that the following GetXXX() functions will later be given arguments virtual coreRef< IMesh > GetMesh() = 0; // retrieves a mesh from the mesh manager virtual coreRef< ITexture > GetTexture() = 0; // retrieves a texture from the texture manager virtual coreRef< ITerrain > GetTerrain() = 0; // retrieves a terrain from the terrain manager};IGraphics* IGraphics::graphics = NULL;
and the derived class that keeps throwing errors, along with my testing main():
class dummy : public IGraphics{ public: virtual coreRef< IMesh > GetMesh(){ return coreRef< IMesh >::null; } // retrieves a mesh from the mesh manager virtual coreRef< ITexture > GetTexture(){ return coreRef< ITexture >::null; } // retrieves a texture from the texture manager virtual coreRef< ITerrain > GetTerrain(){ return coreRef< ITerrain >::null; } // retrieves a terrain from the terrain manager protected: private: };int main(int argc, char **argv){ coreRef< IGraphics > graph = IGraphics::GetInterface< dummy >(); return 0;}
The errors are to do with the returns in class 'dummy'. For each one I get an 'Undefined reference to coreRef< x >::null', where 'x' is the class in question.
Currently, each of the IMesh, ITexture and ITerrain classes are stubs that have no code in them.