小编Aru*_*run的帖子

转换运算符如何返回值?

对于A类,整数转换运算符看起来像;

operator int() //Here we don't specify any return type
{
    return intValue;
}
Run Code Online (Sandbox Code Playgroud)

当上面的函数看起来没有指定返回值类型时,它是如何返回一个值的?它似乎没有返回"任何东西",但我知道它不是void.

如果未指定返回类型,这有何意义?

c++ casting operators

17
推荐指数
2
解决办法
3228
查看次数

标签 统计

c++ ×1

casting ×1

operators ×1