Recent addition to C++ is the Run Time Type Identification system - allows a type of cast that is checked at run time.
aBall = ....; aBlackBall = dynamic_castbut only works if the class Ball has at least one virtual method.(aBall); if (aBlackBall) { // it was a black ball } else { // it was not a black ball }