简体   繁体   中英

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. If not, please update your question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM