powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Java [игнор отключен] [закрыт для гостей] / Множественное наследование
2 сообщений из 127, страница 6 из 6
Множественное наследование
    #34081063
Leonidv
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Повторите. А лучше все-таки разъясните, что происходит в описанном мною случае?
...
Рейтинг: 0 / 0
Множественное наследование
    #34081582
NotGonnaGetUs
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
LeonidvПовторите. А лучше все-таки разъясните, что происходит в описанном мною случае?

Не вижу "описанного" вами случая.
Вижу только не способность пользоваться гуглом.

http://www.gotw.ca/publications/mill06.htm


There is one additional feature we can get using nonpublic inheritance, and it's the only one that doesn't model IS-IMPLEMENTED-IN-TERMS-OF:

We need "controlled polymorphism" LSP IS-A, but in certain code only.

Public inheritance should always model IS-A as per the Liskov Substitution Principle (LSP).[3] Nonpublic inheritance can express a restricted form of IS-A, even though most people identify IS-A with public inheritance alone. Given class Derived : private Base, from the point of view of outside code, a Derived object IS-NOT-A Base, and so of course can't be used polymorphically as a Base because of the access restrictions imposed by private inheritance. However, inside Derived's own member functions and friends only, a Derived object can indeed be used polymorphically as a Base (you can supply a pointer or reference to a Derived object where a Base object is expected), because members and friends have the necessary access. If instead of private inheritance you use protected inheritance, then the IS-A relationship is additionally visible to further-derived classes, which means subclasses can also make use of the polymorphism.
...
Рейтинг: 0 / 0
2 сообщений из 127, страница 6 из 6
Форумы / Java [игнор отключен] [закрыт для гостей] / Множественное наследование
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]