在visual studio 2017中怎样将类作为友元
1、打开一个cpp文件。

2、来到Building类中。

3、首先写上friend。

4、后面跟上class。

5、class 后面写上类名,如GoodGay,这样GoodGay就成为了Building类的友元类了。

6、那么GoodGay类就可以访问Building类中的私有属性了。

1、打开一个cpp文件。
2、来到Building类中。
3、首先写上friend。
4、后面跟上class。
5、class 后面写上类名,如GoodGay,这样GoodGay就成为了Building类的友元类了。
6、那么GoodGay类就可以访问Building类中的私有属性了。