I have an Abstract class, say Animal. From this class, I have many inheriting classes, such as Cat, Dog, Mouse. I have
You need to introduce a temporary of type Animal*:
Dog *d = new Dog(x); //some parameter x.
Animal *a = d;
Animal **animal = &a;
someMethod(animal);
The reason for this is that &d is Dog**, which cannot be converted to Animal** even if Dog* can be converted to Animal*.
Normally you 'd fix this inline using something like this (warning -- does not compile!):
Dog *d = new Dog(x); //some parameter x.
Animal **animal = &(static_cast(d));
someMethod(animal);
However, this is not possible because the return value of static_cast is a temporary (technically, its a rvalue) so you cannot get its address. Therefore, you need the extra Animal* local to make this work.