array of polymorphism classes

I am making a program that has an different classes that share the same ancestor class. I have them all in an c-style array, where the variable i is used to select which class is used.

However, an acquaintance of mine said that this is bad programming practice due to different storage sizes that may occur between each class.

Is this true, and if it is what are other ways to do this?
Yes, this is true. In this case you should use the array of pointers to base class. And I don't understand why would you use some variable "i" to choose the exact implementation. This is exactly what you should try to avoid in most cases and let the virtual function mechanism do that for you.

It is hard to say anything more unless you post some actual code (don't forget to use code tags).
Since you mentioned polymorphism in your title, and you seem to have mentioned inheritance in the body of your post, I think you're doing it right, but we will need to see some sample code to be sure. You lose me when you say
where the variable i is used to select which class is used.
since that could mean you are keeping track of which element in the array belongs to which class (this is the wrong way to do this) or it could simply mean you happen to be using the variable 'i' to address which object in the array you want to select.
Topic archived. No new replies allowed.