How is Upcasting related to Base class pointer pointing to derived class object?
A derived-class reference or pointer is Upcast to a base class. To put it another way, upcasting enables us to handle derived types as if they were their base types.
Without an explicit typecast, public inheritance is always permitted. This is a result of the base and derived classes having an is-a relationship.
Although C++ permits a base pointer to point to any object derived from that base, The pointer cannot be directly used to access all the members of the derived class we may have to use another pointer declared as a pointer to the derived type.
Base Class Pointer Pointing to Derived Class Object in C++
Prerequisite: Pointers in C++
A pointer is a data type that stores the address of other data types. Pointers can be used for base objects as well as objects of derived classes. A pointer to the object of the derived class and a pointer to the object of the base class are type-compatible (may be used in different ways).
The pointer of Base Class pointing different objects of the derived class