如何使C ++结构包含其他结构作为成员变量

时间:2013-03-06 02:32:14

标签: c++ data-structures

我想知道如何在来自另一个结构的结构中定义变量。例如:

struct Date
{
    int month;
    int day;
    int year;
};

struct Profile
{
    START DATE
    END DATE
    int hours_worked
    etc...
};

1 个答案:

答案 0 :(得分:4)

struct Profile {
    Date start;
    Date end;
    // etc...
};

这就是你想要的吗?如果是这样的话,我强烈建议您手头有一本教科书,而不是SO是C ++问题的首选,直到您更加经验丰富。如果没有,请更新您的问题。

相关问题