overload7.c
来自「this is a gcc file, you can download it 」· C语言 代码 · 共 42 行
C
42 行
// GROUPS passed overloadingextern "C" int printf (const char *, ...);struct NoName { int first; int second;};class Casted { public: NoName x; double y; Casted ( int _x , double _y ): y(_y) { x.first = _x; x.second = _x*2; } operator NoName() const { return x; } operator double() const { return y; }};int main(){ Casted c(10,12.34); NoName x; double y; x = c; y = c; if (x.first == 10 && x.second == 20 && y == 12.34) printf ("PASS\n"); else { printf ("FAIL\n"); return 1; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?