下面这个函数 operator FontHandle() const { return f; }
前面的operator关键字是什么意思啊?返回值?The alternative is to have Font offer an implicit conversion function to its FontHandle:
class Font {public: ... operator FontHandle() const { return f; } // implicit conversion function ...};
That makes calling into the C API easy and natural:
Font f(getFont());int newFontSize;...changeFontSize(f, newFontSize); // implicitly convert Font // to FontHandle
The downside is that implicit conversions increase the chance of errors. For example, a client might accidently create a FontHandle when a Font was intended:
前面的operator关键字是什么意思啊?返回值?The alternative is to have Font offer an implicit conversion function to its FontHandle:
class Font {public: ... operator FontHandle() const { return f; } // implicit conversion function ...};
That makes calling into the C API easy and natural:
Font f(getFont());int newFontSize;...changeFontSize(f, newFontSize); // implicitly convert Font // to FontHandle
The downside is that implicit conversions increase the chance of errors. For example, a client might accidently create a FontHandle when a Font was intended:
解决方案 »
- 在mfc中用wpf做界面 可以在界面上画图 求指导
- 关于工作线程?
- socket recv 10035
- ShellExecute如何打开一个web页面, 这个页面没有工具栏, 还要指定大小和位置
- 为什么这样显示不了位图
- 经过VeriSign签名认证的OCX还是无法通过网页正常安装, 为什么啊
- 微软面试题一道,请大家来做(答案三天后揭晓)
- 在视图中如何显示一个换行字符串?
- 请问GlobalAlloc分配的内存是不是连续的啊
- 同一份代码不同时编译。EXE和PDB被windbg强制加载匹配的成功率是多少?
- 什么情况下数据放CDocument类里什么情况放CView里?
- CTabCtrl如何把标签给隐藏起来哦?
比如最常见的
void operator=(const CXXX &ob)
{
...
}至于你这个operator FontHandle() const { return f; }
你就把FontHandle当一个函数就行了