hit counter


My development logbook

Item 39: Avoid Casts Down the Inheritance Hierarchy

It touches on the topic of downcasting (cast a derived class to its base class)

First of all, downcasting itself is usually unnecessary in most situation where the virtual functions are suffice.

If it must be done, use dynamic_cast. It will return null if cast is unsuccessful