编辑代码

#include <iostream>
using namespace std;
class Person{
public:
    Person(){
        cout<<"无参构造函数的调用"<<endl;
    }
    Person(int a){
        cout<<"有参构造函数的调用"<<endl;
    }
    Person(const Person&p){
        m_Age=p.m_Age;
        cout<<"拷贝构造函数的调用"<<endl;
    }
    ~Person(){
        cout<<"析构函数的调用"<<endl;
    }
    int m_Age;
};
void test01(){
    Person p1;//1
    Person p2(1);//2
    p2.m_Age=10;
    Person p3(p2);//3
    Person p4=Person(100);//4
    Person p5=Person(p2);//5
    Person(100);
}
int main() {
    //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 
	//cout << "Hello JSRUN!   \n\n         - from C++ ." << endl;
	test01();

    
    return 0;
}