I have been reading some other threads on this site, and they mention how dynamic_cast and static_cast are both safe for upcasting.
Why are these even required for upcasting?
For example, if class B is derived from A, then
A * ptr = new B ();
still works, and behaves like an object of type A. (I am also from a Java background where conversion for upcasting is unnecessary.
I also read on this site that dynamic_cast is not needed for downcasting [in question "When should static_cast, dynamic_cast and reinterpret_cast be used?"] . Again, I would think that casting is only really necessary when you are downcasting since upcasting occurs automatically.
Where am I wrong?