您的位置:首页 > 其它

Aggregate Class(聚合类)的使用

2015-09-28 00:33 316 查看
struct Data
{
    int ival;
    string s;
};

//class Data
//{
//public:
//    int ival;
//    string s;
//};

int _tmain(int argc, _TCHAR* argv[])
{
    Data data = { 12, "hello" };//the initializers must appear in declaration order of the data members.
    cout << data.ival << endl;
    return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: