which situation will use clone in c++ and how to use?
<p>What is the difference between virtual clone and clone?
I find the following example, it clone derived to base, what is it for?</p>

<pre><code>class Base{
public:
    virtual Base* clone() {return new Base(*this);}
    int value;
    virtual void printme()
    {
        printf("love mandy %d\n", value);
    }
};
class Derived : public Base
{
public:
    Base* clone() {return new Derived(*this);}
    virtual void printme()
    {
        printf("derived love mandy %d\n", value);
    }
};

Derived der;
    der.value = 3;

    Base* bas = der.clone();
    bas-&gt;printme();
</code></pre>
