fork download
#include 
#include 

class Animal
{
public:
    virtual Animal* clone() const = 0;
    virtual char type() = 0;
};

Animal* new_clone(Animal const& other){
  return other.clone();
}

class Cat : public Animal
{
public:
    Cat* clone() const{ return new Cat(*this); }
    char type() { return 1; }
};

class Zoo
{
public:
    boost::ptr_vector animals;
};

int main()
{
    std::vector allZoos;

    Zoo ourCityZoo;
    ourCityZoo.animals.push_back(new Cat());

    allZoos.push_back(ourCityZoo);
    allZoos.clear();

    return 0;
}
Success #stdin #stdout 0.01s 2860KB
stdin
Standard input is empty
stdout

Standard output is empty