Welcome and thank you in advance for any help on the following subject.
Edit: I forgot to add that this is an embedded system without access to STL features. We apologize for leaving this important information. This is my first C ++ encoding, so I forgot to mention the obvious. I returned to add this fact, and this question has already received some answers. Thanks to everyone for such a quick reply!
I am trying to initialize a member of an array of structure, which in turn is a public member of a C ++ class. The size of the array is omitted in the structure. Here is an example:
// ClassA.h Class A { public: struct StructA { StructB structs[]; }; struct StructB { // stuff }; ClassA(); //etc }; // ClassB.h ClassB: public ClassA { public: StructA structA; ClassB() // etc }; // ClassB.cpp // What do I do here?
I tried:
StructA ClassB::structA.structs[] = { first, second, third }
no luck. I'm relatively new to C ++, so that put me on my guard. I can add size to an array element in StructA, but I would prefer there is a legitimate way to handle this.
Thanks!
source share