c++初始化列表写在类外该如何声明

class Person
{
public:
	//初始化列表声明
	Person(string name, Phone phone);

	string m_Name;
	Phone m_Phone;
};

Person::Person(string name, Phone phone) : m_Name(name), m_Phone(phone)
{
	cout << "Person类的初始化列表函数" << endl;
}
posted @ 2021-08-15 15:06  liuhengzhi  阅读(152)  评论(0编辑  收藏  举报