#include <iostream>
using namespace std;
class Phone{
public:
Phone(string phone, int much):m_phn(phone),m_much(much)
{
cout<<"Phone构造函数"<<endl;
}
~Phone()
{
cout<<"Phone析构函数"<<endl;
}
string m_phn;
int m_much;
};
class Person{
public:
Person(int age, string phone, int much ):m_age(age),m_phone(phone,much)
{
cout<<"Person构造函数"<<endl;
cout<<"age:"<<m_age<<endl;
cout<<"phone:"<<m_phone.m_phn.c_str()<<endl;
cout<<"much:"<<m_phone.m_much<<endl;
}
~Person()
{
cout<<"Person析构函数"<<endl;
}
int m_age;
Phone m_phone;
};
void test1()
{
Person per(20,"小米10",3000);
}
int main()
{
test1();
return 0;
}