-1

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...
};
djechlin
  • 59,258
  • 35
  • 162
  • 290
Patrick
  • 93
  • 1
  • 1
  • 9
  • 1
    You mean something like `Date startDate;`? It works like any other type. – chris Mar 06 '13 at 02:33
  • Perhaps you were confused about what `struct`s are? They're just classes with member visibility defaulted to public. As chris stated, think of classes and structs as custom types (such as int) that you have defined yourself. – JBentley Mar 06 '13 at 02:36

1 Answers1

4
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.

djechlin
  • 59,258
  • 35
  • 162
  • 290