vendredi 31 octobre 2014

Polymorphism and std::vector


Vote count:

0




So I have a vector of "Widgets"



std::vector<Widget> widgets;


And a class called dial which extends Widget



class Dial : public Widget


And also a loop which loops through all the Widgets in widgets. However, there is and update method in Widget which gets overriden in Dial, and whenever I loop through widgets it calls Widget's update and not Dial's update. How can I fix this? (It also calls Widget's draw and not Dial's as well)



asked 23 secs ago







Polymorphism and std::vector

Aucun commentaire:

Enregistrer un commentaire