c++中friend class
来源:互联网 发布:淘宝如何最快提交订单 编辑:程序博客网 时间:2024/06/05 02:06
// friend class#include <iostream>using namespace std;class Square;class Rectangle { int width, height; public: int area () {return (width * height);} void convert (Square a);};class Square { friend class Rectangle; private: int side; public: Square (int a) : side(a) {}};void Rectangle::convert (Square a) { width = a.side; height = a.side;}int main () { Rectangle rect; Square sqr (4); rect.convert(sqr); cout << rect.area(); return 0;}
阅读全文
0 0
- [C++] C++中friend的使用(friend function and friend class)
- [C++] friend class
- C++::Class Friend
- c++中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)
- C++中friend的使用(friend function and friend class)
- friend class
- friend class
- friend class
- [C++]friend
- 实验: friend class
- C++ class friend
- 地基工friend class
- About "friend class"
- 知识点摘录
- VirtualBox配置网络方式
- Unity 游戏框架搭建 (四) 简易有限状态机
- STL
- [kuangbin带你飞]专题九 连通图 E
- c++中friend class
- Bringing up interface eth0: Device eth0 does not seem to be present,delaying initialization
- 信息安全技术知识:Kerberos协议的工作过程
- JsonValue、JsonString、JsonNumber源码翻译
- el表达式设置option标签selected
- pycharm template
- 详解阿里海报设计AI“鲁班”,没错,人类设计师危险了
- vue.js 组件之间传递数据
- Log4j2的配置及使用方式