So I have been programming in C++ for a while now, and I was told that using a dynamic cast to cast a pointer of an abstract class pointer to a different concrete class pointer was bad practice.
Shape* GeneralShape = new Triangle(...); Triangle* triPtr = dynamic_cast<Triangle*>(GeneralShape);
Where Shape is an abstract class and Triangle inherits from it.
Using a dynamic cast just seems like a convenient way to access member functions when one of your inherited classes is just a little too different and needs more than the general functions that the abstract class contains. I was just wondering what’s bad or what is the overhead in having run-time polymorphism?
Source: Windows Questions C++