The code is very dangerous. It suggests that somefunc will assign a value to the pointer, such as this:
Code:
void somefunc(base **bp)
{
*bp = new derived;
}
This way, after somefunc returns, ptr points to a derived object. So far, so fine. But look, this is also perfectly valid for somefunc to do:
Code:
void somefunc(base **bp)
{
*bp = new base;
}
It's just a pointer to base, so you can assign the address of a base object to it, right? Or any object derived from base, perhaps other_derived.
On the other hand, if you do that, suddenly ptr points not to a derived, but a base or an other_derived. Welcome to the land of hidden bugs.
In other words, while casting a pointer to a derived class to a pointer to a base class is perfectly safe and can be done implicitly, casting a pointer to a pointer to a derivd class to a pointer to a pointer to a base class is a big no-no.