Converting a reference or pointer to a derived class into a reference or pointer to a base class (upcast) is allowed for public inheritance - a relationship of the type "is". The reverse process (conversion of a pointer or a reference to a base class to a pointer or a reference to a derived class (downcast)) is not allowed without an explicit type conversion since the relation "is" is not symmetrical. A derived class can add new members to the class that these members use (they are not applicable to the base class).
Ввійдіть щоб вподобати
Ввійдіть щоб прокоментувати