⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example4.cpp

📁 Advanced Internet Programming Lecture 2 C/C++ Review Li,Suke School of Software and Microelectroni
💻 CPP
字号:
#include <iostream>using namespace std;class myclass {  int a, b;public:  friend int sum(myclass x);  void set_ab(int i, int j);};void myclass::set_ab(int i, int j){  a = i;  b = j;}// Note: sum() is not a member function of any class.int sum(myclass x){  /* Because sum() is a friend of myclass, it can     directly access a and b. */  return x.a + x.b;}int main(){  myclass n;  n.set_ab(3, 4);  cout << sum(n);  return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -