How to create a dynamic array of an Abstract class?
Posted
by outsyncof
on Stack Overflow
See other posts from Stack Overflow
or by outsyncof
Published on 2010-04-27T00:04:44Z
Indexed on
2010/04/27
0:13 UTC
Read the original article
Hit count: 274
Lets say I have an abstract class Cat that has a few concrete subclasses Wildcat, Housecat, etc.
I want my array to be able to store pointers to a type of cat without knowing which kind it really is.
When I try to dynamically allocate an array of Cat, it doesn't seem to be working. Please help?
Cat* catArray = new Cat[200];
© Stack Overflow or respective owner