#include<iostream>
using namespace std;
#include<vector>
class Person
{
public:
Person(string name, int age)
{
mName = name;
mAge = age;
}
string mName;
int mAge;
};
void test01()
{
vector<Person> v;
v.push_back(Person("坤坤", 18));
v.push_back(Person("咯咯", 20));
for (vector<Person>::iterator it = v.begin(); it != v.end(); it++)
{
cout << "Name: " << (*it).mName << " Age: " << (*it).mAge << endl;
}
}
int main() {
test01();
}
08-18
388
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-17
307
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-12