I have a doubt about about a line of the code wrote from my professor.
This is the full code.
The class Gui has a std::list<const AbstractButton*> Buttons and the function std::vector<AbstractButton*> removeUnchecked(){} wants a vector as return type and we had to remove from the Gui every checkable buttons with the attribute checked == false and put in the returned vector.
The professor wrote CheckBox* p = const_cast<CheckBox*>(dynamic_cast<const CheckBox*>(*it)); performing a dynamic_cast first and then a const_cast
If I had written CheckBox* p = dynamic_cast<CheckBox*>(const_cast<AbstractButton*>(*it)) would it be the same thing? (const_cast first and then dynamic_cast)
Aucun commentaire:
Enregistrer un commentaire