class Cloneable
{
public:
virtual Cloneable* clone() const = 0; //return copy of itself
virtual ~Cloneable() {}
};
class A
{
public:
A(const A& a);
~A();
private:
Cloneable* b;
Cloneable* c;
std::string* s;
};
A::~A()
{
delete b;
delete c;
delete s;
}
Please, help me to understand cloneable pattern. I don't understand how to implement constructor, copy constructor of class A and how can I use it?
Aucun commentaire:
Enregistrer un commentaire