当前位置: 云海天教程网 > 技术新闻 > 编程语言 > 正文 C/C++强转 作者: 佚名 来源: 网络转载 时间:2019-12-03 通过重载来进行强转变形。 #include<stdio.h> class Float { public: operator int() { return 1; } }; int main() { printf("%d ",(int)Float()); }