What would be a use case for dynamic_cast of siblings?
<p>I'm reading Scott Meyers' More Effective C++ now. Edifying! Item 2 mentions that dynamic_cast can be used not only for downcasts but also for sibling casts. Could please anyone provide a (reasonably) non-contrived example of its usage for siblings? This silly test prints 0 as it should, but I can't imagine any application for such conversions.</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

class B {
public:
    virtual ~B() {}
};

class D1 : public B {};

class D2 : public B {};

int main() {
    B* pb = new D1;
    D2* pd2 = dynamic_cast&lt;D2*&gt;(pb);
    cout &lt;&lt; pd2 &lt;&lt; endl;
}
</code></pre>