是否可以访问类的私有成员? [英] Is it possible to access private members of a class?

查看:94
本文介绍了是否可以访问类的私有成员?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以访问c ++中类的私有成员。

Is it possible to access private members of a class in c++.


只要您没有朋友
函数,并且您无权访问
类定义

provided you don't have a friend function and You don't have access to the class definition


推荐答案

意味着使用一些指针算术来获得访问?这是可能的,但肯定是危险的。还要查看此问题:访问私人成员

You mean using some pointer arithmetic to gain the access ? It is possible but is definitely dangerous. Take a look at this question also: Accessing private members

这篇关于是否可以访问类的私有成员?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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