I encountered a question today, found here, which raised this question for me.
Here\'s a pseudo-code example of what I\'m getting at:
class Car{
publ
Yes, this is usually the better design case. You should only introduce a virtual function into the hierarchy if it makes sense for all derived classes.
However, your MODEL enum is completely worthless- that's what dynamic_cast
is actually for.
if(Lamborghini* lambo = dynamic_cast(cars[i])) {
lambo->retractTheRoof();
}