...
Code Block | ||||
---|---|---|---|---|
| ||||
struct B { virtual ~B() = default; }; struct D : B { virtual ~D() = default; virtual void g() { /* ... */ } }; void f() { B *b = new D; // Corrected dynamic object type // ... void (D::*gptr)() = &D::g; // RemovedMoved static_cast to next line (static_cast<D *>(b)->*gptr)(); delete b; } |
...