#pragma region 11.21.stone1.cpp
////程序清单
//xxx.cpp -- user-defined conversion functongs
#if 1
#include <iostream>
#include"stonewt1.h"
int main()
{
using std::cout;
Stonewt popins(9, 2.8);
double p_wt = popins;
cout << "Convert to double => ";
cout << "Poppins: " << p_wt << " pounds.\n";
cout << "Convert ot int => ";
cout << "Popings: " << int(popins) << " pounds.\n";
return 0;
}
#endif
#pragma endregion
下面是程序清单 11.19~程序清单11.21组成的程序的输出;它显示了将 Stonewt对象转换为 double 类型和 int 类型的结果:
一下课我们分析一下测试代码

891

被折叠的 条评论
为什么被折叠?



