c++中friend function
来源:互联网 发布:c语言编程工具哪个好 编辑:程序博客网 时间:2024/06/11 18:41
#include <iostream>using namespace std;class Rectangle { int width, height;public: Rectangle () {} Rectangle (int x, int y) : width (x), height (y) {} int area () {return width * height;} friend Rectangle duplicate (const Rectangle&) ;};Rectangle duplicate (const Rectangle& param) { Rectangle res; res.width = param.width * 2; res.height = param.height * 2; return res;}int main(int argc, char const *argv[]){ Rectangle foo; Rectangle bar (2, 3); foo = duplicate (bar); cout << foo.area() << "\n"; return 0;}
阅读全文
0 0
- [C++] C++中friend的使用(friend function and friend class)
- c++中friend function
- C++中friend的使用(friend function and friend class)
- C++中friend的使用(friend function and friend class) .
- C++中friend的使用(friend function and friend class)
- C++中friend的使用(friend function and friend class)
- C++中friend的使用(friend function and friend class)
- C++中friend的使用(friend function and friend class)
- friend function
- friend class & function
- friend function in C++
- [C++]friend
- C++ friend function and friend class
- [C++] friend class
- C++::Class Friend
- C++——friend
- c++ operator定义为friend function
- C++ friend template operator overload function
- 单链表的建立(C语言):头插法和尾插法建立单链表
- jdk8生成javadoc报错的解决
- 浏览器兼容性问题解决方案· 总结
- 2017-2018 ACM-ICPC, NEERC, Southern Subregional Contest
- Centos6.8安装Mysql5.6
- c++中friend function
- Python logging模块
- 无行不至远方,无思不及深邃
- tomcat集群-基于redis的session共享
- Unity 游戏框架搭建 (一) 概述
- Course 4-Convolutional Neural Networks--Week 3
- php 反射
- Unity 游戏框架搭建 (二) 单例的模板
- 如何用好 github 中的 watch、star、fork