Cast a base class issues
<pre><code>class YourInterface {
public:
    YourInterface(){
    }

    virtual ~YourInterface(){
    }

    virtual void saveData(Data data) = 0; //Pure virtual = Childs are forced to implement those functions to become non abstract
    virtual Data loadData() = 0;
};

//One implementation to load and save data to/from a xml file
class XmlImplementation : public YourInterface {
public:
    XmlImplementation(){
    }

    virtual ~XmlImplementation(){
    }

    //Overriding functions:
    void saveData(Data data){
        //Save data to a xml file here
    }

    Data loadData(){
        //Load data from a xml file here
    }
};

void main(){
    YourInterface* p;
    p = (YourInterface*) new XmlImplementation();

    p-&gt;loadData(); //We just want to get our Data here, we dont care whether its from a xml or binary file etc.
}
</code></pre>

<p>Please take that as an example, I know it is not good but I can't write any better than that.</p>

<p>I'd like to know better why the cast in main refuses to work properly ? and it has been suggested as an errorful cast.</p>
