C++ problem (why does it assume my class is an union?)

Started by
9 comments, last by Zahlman 18 years, 5 months ago
Quote:Original post by Marianne
The weird thing is, if i declare them like this:

vector<T3PointGr*> tex_areas;
vector<T2Button*> poses_buttons;

poses_buttons is not going to work and the other will work fine. However if i declare them like this:

vector<T2Button*> poses_buttons;
vector<T3PointGr*> tex_areas;

tex_areas is not going to work while the other works fine.

Why does the order in which i declare the vectors make them behave weirdly??


Heap corruption, almost certainly. BTW, you should normally store vectors of instances, rather than vectors of pointers (unless polymorphism is required and/or there is a *simple* scheme by which the objects are shared).


This topic is closed to new replies.

Advertisement