class person
{
public:
person(int a, int b, int c)//传统初始化
{
ma = a;
mb = b;
mc = c;
}
person() :ma(10), mb(20), mc(30)//初始化列表来初始化
{
}
int ma;
int mb;
int mc;
};
int main()
{
preson p(10,20,30);
}
构造函数与析构函数
于 2023-10-06 17:00:25 首次发布