According to this answer, dynamic_cast
'ing a base class to derived class is fine, but he says this shows that there is a fundamental problem with the code logic.
I've looked at other answers and using dynamic_cast
is fine since you can check the pointer validity later.
Now in my real problem the derived class has a GetStrBasedOnCP
function which is not virtual (only the derived class has it) and I have to access it.
What is better, to create a virtual void GetStrBasedOnCP
on the base class and make it virtual
on the derived OR, to just cast the base class pointer to derived class?
Oh also notice that this is a unsigned int GetStrBasedOnCP
so the base class must also return a value...