嵌套类C ++ [英] Nested Classes C++

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

问题描述

可能的重复项:
嵌套类C ++
C ++中的嵌套类访问控制

Possible Duplicates:
nested classes C++
nested class access control in C++

对于嵌套类对封闭类成员的访问权限,我有些困惑.它与外部阶级有什么关系?

I'm a little confused as to what access a nested class has to the members of an enclosing class. What is the relationship it shares with the outer class?

推荐答案

嵌套类对封闭类没有任何其他类无法使用的特殊访问权限-它可以看到公共成员,等等.嵌套仅为嵌套类提供了有用的作用域定义机制,但没有更改其行为或功能.

The nested class does not have any special access to the enclosing class that would not be available to any other class - it can see public members, etc. The nesting only provides a useful scoping mechanism for nested class, but doesn't change its behavior or capabilities.

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

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