What conversions between a base and a derived class for references and pointers are allowed without explicit type casting in the case of public inheritance?
Explanation
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).

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести