I have an Abstract class, say Animal
. From this class, I have many inheriting classes, such as Cat
, Dog
, Mouse
. I have
You need an Animal*
:
Dog* d = new Dog(x);
Animal* a = d;
Animal** animal = &a;
someMethod(animal);
An Animal**
can only point to an Animal*
. It would be very bad if it could point to a Dog*
. If it could, you could do something like this:
Dog* d = new Dog(x);
Animal** animal = &d;
*animal = new Hippopotamus();
Now d
points to a Hippopotamus
, which is very wrong indeed.