Hello, I am having difficulty understanding how to get CPP polymorphism working through pointers-to-pointers. Here is the basic problem, let's say I have 2 classes:
class Base { };
class Child : public Base { };
So now I can do cool things like:
Base* base = new Base();
Child* child = new Child();
base = child;
and generally use Child* wherever I could use Base*. Textbook polymorphism, a triumph of civilized man!
The problem is, I would also like to be able to use Child** wherever I could use Base**, but my compiler prohibits it. For example, this gives an error "cannot convert from 'Child**' to 'Base**'":
Base** base;
Child** child;
base = child;
Can anyone shed some light onto this situation? Am I doomed to being able to take advantage of polymorphism only at the first level of pointer indirection? I humbly request your aid, GDNet!