When learning about polymorphism you commonly see something like this
class Base { int prv_member; virtual void fn(){} }
class Derived : Base { int more_data; virtual void fn(){} }
What is upcasting or downcasting? Is (Derived*)base_ptr; an upcast or downcast?
I call it upcast because you are going away from the base into something more specific. Other people told me it is a downcast because you are going down a hierarchy into something specific with the top being the root. But other people seem to call it what i call it.
When converting a base ptr to a derived ptr is it called upcasting or downcasting? and if someone can link to an official source or explain why its called that than great.
virtualis unnecessary but doesn't "hurt". Can you elaborate on why you think it should not be used at all in that context?