Original Post
I have a manager class which holds all GUI components in my engine. All GUI components are derived from GUIBase. The manager class contains an array of GUIBase pointers to all GUI components. The rendering object is supposed to iterate through this array and draw the components according to what kind of object it finds. Is there a fast approach for identifying what kind of object the GUIBase pointer is pointing to? I know of the typeid() macro, but I''m pretty sure this will slow down the engine.
PS. Notice that I have put all my drawing code into a render object. I did this for the sake of good OO design, but I''m not so sure about the decision anymore. If I put a virtual function draw() in GUIBase, the sub-classes could override, and this whole mess would be avoided. Thoughts?