下面是一个写兔子拔萝卜吃萝卜的程序:
#include<iostream>
#include<vector>
using namespace std;
class Carrot
{
public:
static int quantity;
};
int Carrot::quantity = 0;
class Rabbit
{
public:
vector<Carrot> carrots;
void pullCarrots(int n)
{
for (int i = 0; i < n; i++)
{