Let's say I have a class Foo with a virtual method
virtual void initialize(InitParams& params);
Since there will be classes that derive from Foo, is it good practice to also subclass InitParams and static_cast them to the specific InitParams for that class?
Me as a programmer has to ensure that I actually pass the correct InitParams to the method. Are there any other downsides? I want to store multiple Foo instances in a collection so it's important for me to have this generic virtual initialize method.
Aucun commentaire:
Enregistrer un commentaire