- 2
- 0
- 约6.89千字
- 约 49页
- 2017-03-15 发布于江西
- 举报
第4讲--虚函数与多态性.ppt
* class Complex public: ... Complex operator + Complex c ; Complex operator - Complex c ; protected: double _Real;//复数实部 double _Image;//复数虚部 ; * Complex Complex::operator + Complex c Complex t; t._Real getReal +c.getReal ; t._Image getImage +c.getImage ; return t; Complex Complex::operator - Complex c Complex t; t._Real getReal -c.getReal ; t._Image getImage -c.getImage ; return t; * void Complex::print( ) cout _Real , _Image endl; void main( ) //主函数 Complex c1 5,4 ,c2 2,10 ,c3; //声明复数类的对象 cout c1 ; c1.print( ); cout c2 ; c2.prin
原创力文档

文档评论(0)