📄 classillusfriendimp.cpp
字号:
#include <iostream>
#include "classIllusFriend.h"
using namespace std;
void classIllusFriend::print()
{
cout<<"In class classIllusFriend: x = "<<x<<endl;
}
void classIllusFriend::setx(int a)
{
x = a;
}
void friendFunc(classIllusFriend cIFObject) //Line 1
{
classIllusFriend localObject; //Line 2
localObject.x = 45; //Line 3
localObject.print(); //Line 4
cout<<endl; //Line 5
cout<<"Line 6: In friendFunc accessing "
<<"the private data member x "
<<localObject.x<<endl; //Line 6
cIFObject.x = 88; //Line 7
cIFObject.print(); //Line 8
cout<<endl; //Line 9
cout<<"Line 10: In friendFunc accessing "
<<"the private data member x "
<<cIFObject.x<<endl; //Line 10
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -