Are array of pointers to different types possible in c++? with example please)
Yes. Two ways:
• Pointers to a base class type, which point to objects of types derived from that base type.
• Untyped void *
pointers, which must be cast manually to the actual object types they point to.
The first approach is standard object-oriented programming.
The second approach is useful for low-level programming (e.g., device drivers, memory management libraries, etc.), and is considered dangerous and suitable only for programmers who know exactly what they're doing. Obviously, it requires additional bookkeeping info to tell you what each pointer's real type is.