|
|
|
Множественное наследование
|
|||
|---|---|---|---|
|
#18+
Повторите. А лучше все-таки разъясните, что происходит в описанном мною случае? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.10.2006, 17:00:49 |
|
||
|
Множественное наследование
|
|||
|---|---|---|---|
|
#18+
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. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.10.2006, 19:32:12 |
|
||
|
|

start [/forum/topic.php?fid=59&msg=34081063&tid=2147692]: |
0ms |
get settings: |
8ms |
get forum list: |
12ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
174ms |
get topic data: |
8ms |
get forum data: |
2ms |
get page messages: |
30ms |
get tp. blocked users: |
1ms |
| others: | 238ms |
| total: | 479ms |

| 0 / 0 |
