copyassign.cpp
来自「压缩包里有教材<<C++模式设计-基于QT4开源跨平台开发框架>」· C++ 代码 · 共 21 行
CPP
21 行
#include <iostream>#include "fraction.h"int main() { using namespace std; Fraction twothirds(2,3); /* using 2-arg constructor */ Fraction threequarters(3,4); Fraction acopy(twothirds); /* using copy constructor */ Fraction f4 = threequarters; /* also using copy constructor */ cout << "after declarations" ; Fraction::report(); f4 = twothirds; /* assignment */ cout << "before multiply" ; Fraction::report(); f4 = twothirds.multiply(threequarters); /* Lots of objects get created here. */ cout << "after multiply" ; Fraction::report(); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?