Dynamic Cast to a Derived Type
hardQuestion 451dynamic_cast safely converts a base pointer to a derived pointer at RUNTIME: it returns a valid pointer if the object really is that type, or nullptr if it is not. The base must be polymorphic (have at least one virtual function).
Create a polymorphic base class Animal (give it a virtual destructor and a virtual string kind() const returning "animal").
Create Dog (overrides kind() -> "dog", adds string bark() const -> "woof") and Cat (overrides kind() -> "cat").
The runner has an Animal* pointing to a Dog. dynamic_cast<Dog*> succeeds (prints "woof"); dynamic_cast<Cat*> returns nullptr (prints "not a cat"). Output the output shown in Expected Output.
Do NOT write a main function.
Expected output
woof not a cat
= newline. The output ends with a newline, so print one after the last line.
Your output
Run your code to see the output here...