Dynamic / static casts apply only to pointers and links.
When the database is virtual, both static and dynamic quotes are used.
class Base {
public:
virtual ~Base() {};
};
class Derived : public Base {
};
int main(int argc, char **argv)
{
Base *b = nullptr;
Derived *d = nullptr;
d = dynamic_cast<Derived *>(b);
d = static_cast<Derived *>(b);
return 0;
}
The second part of the question: if the base is virtual, the derived type is polymorphic. What do you mean exactly?
source
share