I have a factory that creates structs that are all derived from a base struct, and these structs all have default values for certain members. When I add the object to a vector of pointers of base type, it seems to reset to the base member data. The object are still intact and I can access derived members, but type has the base value when referenced from the container.
struct a {
unsigned int type = 0;
};
struct b : a {
unsigned int type = 1;
};
std::vector<a *> container;
b * message = new b;
container.push_back(message);
message->type is 1
container[0]->type is 0
I've tried casting in different ways when I push into the vector to no avail