正在加载图片...
第8章多态性 例8.1用运算符实现复数的加减运算 include"iostream h class CComplex private: double real: double imag public CComplex(double r=0, double i=o) void Printo CComplex operator +(CComplex c) CComplex operator-(CComplex c) CComplex: CComplex (double r, double i eal=r Imag=I,例8.1 用运算符实现复数的加减运算 #include "iostream.h" class CComplex { private: double real; double imag; public: CComplex(double r=0, double i=0); void Print(); CComplex operator +(CComplex c); CComplex operator -(CComplex c); }; CComplex::CComplex (double r, double i) { real = r; imag = i; } 第8章 多态性
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有