C ++朋友继承? [英] C++ friend inheritance?

查看:109
本文介绍了C ++朋友继承?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

子类是否继承主类的朋友关联(主类自己的和与主类成为朋友的其他类)?

Does a subclass inherit, the main class' friend associations (both the main class' own and other classes friended with the main class)?

还是放它

扩展:
如果没有,是否有任何方法可以继承友谊?

To expand: And if not, is there any way to inherit friendship?

我按照Jon的建议发布了设计问题:

C ++类设计问题

I have followed Jon's suggestion to post up the design problem:
C++ class design questions

推荐答案

友谊不是C ++继承的。

Friendship is not inherited in C++.

标准说(ISO / IEC 14882:2003,第11.4.8节):

The standard says (ISO/IEC 14882:2003, section 11.4.8):


友谊既不是继承也不是传递。

Friendship is neither inherited nor transitive.

这篇关于C ++朋友继承?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆