[英]How to make a C++ structure contain other structure as member variable
I'm wondering how to go about defining a variable in a structure that comes from another structure. 我想知道如何在来自另一个结构的结构中定义变量。 For example: 例如:
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...
};
Is that all you want? 这就是你想要的吗? If so I strongly recommend having a textbook on hand instead of SO being your go-to for C++ questions until you are more seasoned. 如果是这样,我强烈建议手头准备一本教科书,而不是成为C ++问题的入门者,直到您经验丰富为止。 If not, please update your question. 如果没有,请更新您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.