void foobar(Base* base)
{
Derived* derived = dynamic_cast<Derived*>(base); // or static_cast
derived->blabla = 0xC0FFEE;
if (base->blabla == 0xC0FFEE)
...
}
Run Code Online (Sandbox Code Playgroud)
在具有严格别名的编译器上,"派生"是"base"的别名吗?
c++ ×1