explicit2.c
来自「this is a gcc file, you can download it 」· C语言 代码 · 共 25 行
C
25 行
// Build don't link:class string {public: string(const char*) { } explicit string(int size) { }}; void foo(string) { }string bar() { foo("hello"); // ok foo(string(2)); // ok foo(2); // ERROR - no implicit conversion from int to string string x = 2; // ERROR - no implicit conversion from int to string string y(2); // ok foo((string)2); // ok return 2; // ERROR - no implicit conversion from int to string}class A : string {public: A() : string(2) { } // ok};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?