Fork me on GitHub

c++之初始化列表

#include<iostream>
using namespace std;
class Person{
public:
    int m_a;
    int m_b;
    int m_c;
    Person(int a,int b,int c) :m_a(a), m_b(b), m_c(c){}
};
int main() {
    Person p(30,20,10);
    cout << p.m_a << p.m_b << p.m_c<<endl;
    system("pause");
    return 0;
}
posted @ 2019-12-25 10:24  西西嘛呦  阅读(151)  评论(0编辑  收藏  举报