博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Effective c++ 3/e item 15 疑問解惑
阅读量:4285 次
发布时间:2019-05-27

本文共 780 字,大约阅读时间需要 2 分钟。

轉載自

The first operator FontHandle() const     {
return f;}
The second FontHandle operator()() const    {
return f;}

The firstoperator FontHandle, is a conversion operator. It allows an instance of this class type to be implicitly converted to a FontHandle object, so you could write:

Font myFont; FontHandle handle = myFont;

More commonly, conversion operators are used to allow you to use an object of one type as if it were another type in an expression. For example,

void f(FontHandle fh); Font myFont; f(myFont); // converts myFont to a FontHandle via the conversion operator
 

The secondoperator(), is an overload of the function call operator. It allows an instance of your class type to be used as if it were a function taking no arguments:

Font myFont; myFont();

转载地址:http://yhsgi.baihongyu.com/

你可能感兴趣的文章
向量转置怎么求导(多元线性回归原理推导用)
查看>>
Matlab中布尔值/逻辑值与数值型类型的相互转换
查看>>
Matlab 并行代码
查看>>
matlab中的并行方法与理解(2):parfor中的变量类型
查看>>
CentOS 7 命令行模式安装teamviewer13
查看>>
teamviewer Linux centos7安装使用详细
查看>>
【MATLAB】线条标记符大小设置
查看>>
MATLAB中矩阵的逻辑索引方法
查看>>
windows下go dep环境搭建
查看>>
EMQX docker安装及运行
查看>>
使用python和MQTT.fx连接mqtt
查看>>
EMQTT的ACL鉴权(topic权限控制)
查看>>
emqx客户端用户名密码登录验证配置
查看>>
python多线程之信号量semaphore实战
查看>>
ubuntu下忘记mysql密码重置方式
查看>>
ubuntu不在python虚拟环境下使用uwsgi启动django及nginx代理配置
查看>>
flask ORM之SQLAlchemy基本架构实战
查看>>
Python2和python3中类型判断
查看>>
Centos 7上搭建flask项目实战
查看>>
搭建nginx+uwsgi+flask遇到KeyError: 'REQUEST_METHOD'
查看>>