博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
type-cast operator
阅读量:4285 次
发布时间:2019-05-27

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

轉載自 

The type-cast operator uses a particular syntax: it uses the operator keyword followed by the destination type and an empty set of parentheses.

Notice that the return type is the destination type and thus is not specified before the operator keyword.

 

// implicit conversion of classes:#include 
using namespace std;class A {};class B {public: // conversion from A (constructor): B (const A& x) {} // conversion from A (assignment): B& operator= (const A& x) {
return *this;} // conversion to A (type-cast operator) operator A() {
return A();}};int main (){ A foo; B bar = foo; // calls constructor bar = foo; // calls assignment foo = bar; // calls type-cast operator return 0;}

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

你可能感兴趣的文章
关于EF上线文异常问题整理
查看>>
AngularJS路由之ui-router(三)大小写处理
查看>>
AngularJs checkbox绑定
查看>>
C# 扩展方法整理
查看>>
微信小程序开源项目库整理
查看>>
Ionic Grid栅格布局居中实例
查看>>
VS生成Cordova for Android应用之Gradle
查看>>
Cordova 配置WebView可以打开外部链接
查看>>
Ionic Tab选项卡使用整理(一)
查看>>
Ionic Tab选项卡使用整理(二)
查看>>
Ionic Tab选项卡使用整理(三)
查看>>
AngularJs控制器说明(一)
查看>>
Teleport Ultra网站静态资源下载工具
查看>>
AngularJs $http 请求服务整理
查看>>
ionic 加载动作$ionicLoading 和加载动画 ion-spinner
查看>>
使用Git获取最新版本到本地
查看>>
Visual Studio 调试器“启用编辑并继续”
查看>>
Cordova页面解析页面中script标签内容失败,Refused to execute inline script because it violates the following
查看>>
Ionic 中使用iframe嵌入外网页面整理
查看>>
Cordova config.xml配置WebView全屏浏览
查看>>