友元函数和友元类
友元的对象可以是全局的一般函数,也可以是其它类里的成员函数,这种叫做友元函数。
友元还可以是一个类,这种叫做友元类,这时整个类的所有成员都是友元
Problem Description |
---|
Your task is to Calculate a + b. Too easy?! Of course! I specially designed the problem for acm beginners. You must have found that some problems have the same titles with this one, yes, all these problems were designed for the same aim |
Input |
The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line. |
Output |
For each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input. |
Sample Input |
1 6 1 20 |
Sample Output |
7 21 |
https://www.runoob.com/w3cnote/cpp-keyword-intro.html
asm | else | new | this |
---|---|---|---|
auto | enum | operator | throw |
bool | explicit | private | true |
break | export | protected | try |
case | extern | public | typedef |
catch | false | register | typeid |
char | for | return | union |
const | friend | short | unsigned |
const_cast | goto | signed | using |
continue | if | sizeof | virtual |
default | inline | static | void |
delete | int | static_cast | volatile |
do | long | struct | wchar_t |
double | mutable | switch | while |
dynamic_cast | namespace | template | … |