class Person
{
public:
Person(int a,int b)
{
m_Age = a;
m_Height = new int(b);
cout << "this指针的大小为"<<sizeof(this) << endl;
cout << "Person有参构造函数调用" << endl;
}
Person(const Person& p)
{
cout << "拷贝构造函数调用" << endl;
cout << "地址" << int(this) << endl;
m_Height = new int(*p.m_Height);
m_Age = p.m_Age;
}
~Person()
{
if (m_Height != NULL)
{
C++,类引用,链式表达
最新推荐文章于 2025-03-20 16:55:11 发布