编辑代码

#include<iostream>
using namespace std;
class Person
{
public:
	Person(int age)
	{
		this->age = age;
	}
	int age;//默认是0岁
	Person& add(const Person &p)
	{
		this->age += p.age;
		cout << this << endl;
		return *this;
		//
	}
};
void test()
{
	Person p0(18);
	Person p1(32);
	
	cout << &p1.add(p0) << endl;
	cout << &p1 << endl;
}
int main()
{
	test();
	system("pause");
	return 0;
}