michi wrote:
Hello, I've a small problem with something like this:
I've class A and class B, where B is derived from A. In the A class I
need to have a pointer to type of class B. I need to have a pointer to
a array of objects of class B in my A class. Anyone can help?
Whilst the others have shown you how to do it...it is worth pointing out
that a base class knowing about its derived types is not a good design.
Could the A class not contain a pointer to an array of 'A's, that way,
should a new derived class 'C' come along, the array would be able to
store both B and C objects.
Andrew