int main(){
vector<Customer*> newcustomer;
newcustomer.push_back(new Customer("III", 123333, 555));
newcustomer.push_back(new Customer("LOL", 122222, 444));
newcustomer.push_back(new Customer("PPL", 121111, 333));
for (int i = 0; i < 3; i++){
cout << newcustomer[i]->getName() << endl;
cout << newcustomer[i]->getPhone() << endl;
cout << newcustomer[i]->getID() << endl;
cout << endl;
}
system("pause");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
所以我创建了一个名为customer的类,你可以插入新客户,getName返回名称,getPhone返回电话号码,GetID返回ID,现在我想从该向量中删除所有内容,不知道该怎么做.