Instantiating a class that derives from an interface that's inside another class that derives from an interface... just read to find out
<p>I asked a while ago <a href="http://stackoverflow.com/questions/10241134/is-it-possible-to-have-a-virtual-class-declaration-in-a-class">how to use virtual classes in c++</a>, and to my dismay i learned that you can't. But one user,(namely "Emilio Garavaglia" thanks a bunch), posted a way to get something similar to virtual classes, just with some extra code. however, i'm having some trouble getting what i'm doing to compile. here's the code:</p>

<p>global_defs.h</p>

<pre><code>#define Interface class

#define abstract_class class

#define implements : public 
</code></pre>

<p>I_Graphics.h</p>

<pre><code>#ifndef I_GRAPHICS_H
#define I_GRAPHICS_H

#include &lt;string&gt;
#include "global_defs.h"

Interface I_Graphics
{
public:
    virtual ~I_Graphics() {};

    virtual void Initialize() = 0;
    virtual void Frame() = 0;
    virtual void Shutdown() = 0;

    class I_Model;

    virtual I_Model * CreateModel() = 0;

};

Interface I_Graphics::I_Model
{
public:
    virtual ~I_Model() {}

    virtual void Initialize(std::string const &amp; filename, std::string const &amp; textureFilename) = 0;
    virtual void * GetVertexBuffer() = 0;
    virtual void * GetIndexBuffer() = 0;
};


#endif
</code></pre>

<p>Graphics.h</p>

<pre><code>#ifndef GRAPHICS_H
#define GRAPHICS_H

#include "global_defs.h"

#include &lt;map&gt;
#include &lt;string&gt;
#include &lt;memory&gt;
#include "I_Graphics.h"

class Graphics implements I_Graphics
{
public:
    Graphics();
    ~Graphics();

    void Initialize();
    void Frame();
    void Shutdown();

    class Model;

    I_Model * CreateModel() {return new Model;}   // &lt;--- compile error here

private:
    std::map &lt;std::string, I_Model *&gt; m_ModelList;
};

class Graphics::Model implements I_Graphics::I_Model
{
public:
    Model();
    ~Model();

    void Initialize(std::string filename, std::string textureFilename);
    void * GetVertexBuffer();
    void * GetIndexBuffer();
};

#endif
</code></pre>

<p>Graphics.cpp
nothing going here, havn't really started working on the hard part yet, just trying to get the model instantiation to work.</p>

<pre><code>#include "Graphics.h"

Graphics::Graphics()
{

}

Graphics::~Graphics()
{
}

void Graphics::Initialize()
{

}

void Graphics::Frame()
{

}

void Graphics::Shutdown()
{

}

Graphics::Model::Model()
{

}

Graphics::Model::~Model()
{
}

void Graphics::Model::Initialize(std::string filename, std::string textureFilename)
{


}

void * Graphics::Model::GetVertexBuffer()
{
    return NULL;
}

void * Graphics::Model::GetIndexBuffer()
{
    return NULL;
}
</code></pre>

<p>so, as the little comment says, i get an error there saying:</p>

<p><code>error C2512: 'Graphics::Model' : no appropriate default constructor available</code></p>

<p>when there obviously is a constructor for it in graphics.cpp  . Can someone please explain what the compiler is complaining about here?</p>

<p>EDIT:<br>
not sure if it means anything, but when mousing over the little red squiggle in MSVC, it says, "object of abstract class type Graphics::Model is not allowed" . ...but it doesn't have any pure virtual members, so it's not abstract right?</p>

<p>EDIT:<br>
On the suggestion of Castilho, i declare CreateModel in graphics.h like before, but then defined it in graphics.cpp, and it yielded a much more specific error, but i still don't understand why.</p>

<p><code>error C2259: 'Graphics::Model' : cannot instantiate abstract class<br>
1&gt;          due to following members:<br>
1&gt;          'void I_Graphics::I_Model::Initialize(const std::string &amp;,const std::string &amp;)' : is abstract<br>
1&gt;          i_graphics.h(28) : see declaration of 'I_Graphics::I_Model::Initialize'</code></p>
