Given the following class hierarchy in which each class defines a public default constructor and virtual destructor:
class A { /* .. . */};class B : public A { /* ... */};class C : public B { /* ... */};class D : public B, public A { /* ... */};which, if any, of the following dynamic_casts fail?
(a) A *pa = new C;
B *pb = dynamic_cast< B* >(pa);
(b) B *pb = new B;
C *pc = dynamic_cast< C* >(pb);
(c) A *pa = new D;
B *pb = dynamic_cast< B* >(pa);
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.