How to initialize a struct when initializing an object.

So I've built a class that includes a struct as a member variable, and i can't figure out how to initilaize the struct when i initialize the object. the class is inheriting the struct for it's base class.
I'm just starting out learning C++ and my teacher has this way of assigning projects but not going over some of the syntax that's required.

the struct in the header file:

#struct date
{
string day;
string month;
string year;
};


the struct declaration in the base class:

date hireDate;


the class constructor referencing the struct:

Employee(int, string, date);

the constructor definition in the .cpp file:


//constructors
Employee::Employee(int i, string s, date d)
{
id = i;
name = s;
hireDate = d;
}


the initialized class constructor referensing the inherited struct:

ProductionWorker(int, double, int, string, date);


the initialized class constructor definition:

ProductionWorker::ProductionWorker(int s, double p, int i, string n, date d):Employee(i,n,d){
shift = s;
payRate = p;
}


and the object initialization in the main program:

ProductionWorker p1(1, 9.00, 007, "Clyde", {05,27,2001});



everything else in the program runs fine without the struct
And your question is...?
Topic archived. No new replies allowed.