问题如标题所述,示例代码如下:
#include <vector>
//I have a rabbit class...
vector<rabbit> rabbitArmy (numOfRabbits,rabbit());
rabbit* rabbitOnHeap = new rabbit();
rabbitArmy.push_back(*rabbitOnHeap);
提前致谢!
问题如标题所述,示例代码如下:
#include <vector>
//I have a rabbit class...
vector<rabbit> rabbitArmy (numOfRabbits,rabbit());
rabbit* rabbitOnHeap = new rabbit();
rabbitArmy.push_back(*rabbitOnHeap);
提前致谢!