#include<iostream>
using namespace std;
class person{
public:
person(int a,int b,int c){
m_a=a;
m_b=b;
m_c=c;
cout<<"构造函数的调用"<<endl;
}
person(int a,int b,int c): m_a(a),m_b(b),m_c(c)//初始化列表给属性赋初值
{
} 或者(person():m_a(10),m_b(20),m_c(30){})
int m_a;
int m_b;
int m_c;
};
void test1(){
//person p(10,20,30);
person p(30,20,10);或者(person p)
cout<<"m_a的值为:"<<p.m_a<<endl;
cout<<"m_b的值为:"<<p.m_b<<endl;
cout<<"m_c的值为:"<<p.m_c<<endl;
}
int main(){
test1();
return 0;
}