Start by creating the struct. I don't remember, can you declare a struct in the header and define its parameters in the .cpp file?
I rarely use structs....
Anyhow, write your struct, then call the array of structs in the reservations class under the class's private section.
Then write your public functions to interact with the private members.
I like to start with a single .cpp file that also contains my main(), making sure that the class declaration is above my using namepsace std call.
I write the definitions to public functions under the using namespace call.
Once I have everything running as expected I cut the class declaration and includes and paste them into a header, remember to wrap them in an #ifndef macro.
#include the new header in the original .cpp file. Then I cut main() out and put it in its own file and once again #include the new header in the main cpp file...
Remember to add all the files into your project if you're using an IDE, or just to include all .cpp's in a g++ command if you compile in-console.
can you declare a struct in the header and define its parameters in the .cpp file?
for non-templated structs, yes that is possible
OP:
Need to use a class with an array of 10 structures in the private portion of the class and instances of this array of structures are to be created in the public portion
... can you please explain in simple English what this means? I'm lost!
@gunnerfunner: translated into normal English, there's a private array of 10 structs in the class, those will be initialized inside a public function (constructor I suppose)
Start by creating the struct. I don't remember, can you declare a struct in the header and define its parameters in the .cpp file?
I rarely use structs....
Structs are just classes whose members are public by default. So anything you can do with a class, you can do with a struct.