Pet vpet; Dog vdog; //Dog is a derived class with base class Pet. vdog = static_cast<Dog>(vpet); //ILLEGAL! DOWNCASTING
However, casting in the other direction is perfectly legal and does not even need a casting operator:
vpet = vdog; //Legal (but does produce the slicing problem.) UPCASTING