gpt4 book ai didi

c++ - 如果我发现此声明有任何异常(exception)情况,请告诉我

转载 作者:搜寻专家 更新时间:2023-10-31 02:23:57 25 4
gpt4 key购买 nike

经过一些实验,我知道了一些事情,我想概括如下:

The member functions of an instance of a user defined class can not only access its own private data members, but also the private data members of other instances of the same class passed to them as arguments.

请告诉我这是否适用于所有情况。

最佳答案

是的,没错。这称为“同级访问”。更一般地说,类的私有(private)成员函数可以访问同一类的任何实例的私有(private)数据成员,前提是它可以访问该类型的变量。

希望这对您有所帮助!

关于c++ - 如果我发现此声明有任何异常(exception)情况,请告诉我,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28687333/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com