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

How to make a C++ structure contain other structure as member variable

本文关键字:结构体 成员 变量 包含 何使 c++ 其他      更新时间:2023-10-16

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

struct Date
{
    int month;
    int day;
    int year;
};
struct Profile
{
    START DATE
    END DATE
    int hours_worked
    etc...
};
struct Profile {
    Date start;
    Date end;
    // etc...
};

这就是你想要的吗?如果是这样的话,我强烈建议你手头有一本教科书,而不是把它作为你解决c++问题的首选,直到你更熟练为止。如果没有,请更新您的问题