Correct explanation:
// Given..
class Derived : public Base { ... };
// Function which uses p polymorphically
void f(Base* p)
{
// Mainly we will want to use the object p points to
// through virtual functions of Base. However if, in the
// event that p points to a Derived, we want to use
// member functions of Derived (which are not overrides
// of Base functions) we have to use dynamic_cast.
Derived* dp = dynamic_cast<Derived*>(p);
// dp will be non-null only if p points to an object of class
Derived.
if (dp)
{
// Can access full Derived interface through dp here.
}
}
Cheers,
Oliver