24.2 NUMBERS

class Complex

    { private :      double x, y ;    public:      Complex( double a, double b) ;      Complex();      void show() ;      Complex operator +( Complex b );      Complex operator -( Complex b );      Complex operator *( Complex b);      Complex operator /( Complex b);      Complex operator ~( );  };

Class complex will be useful in programs involving such numbers. Real and imaginary parts are defined as “double”. This is the type which can hold very large or very small real numbers.

class RatNum

    { private      long num,den;      double value;    public:      RatNum(long a, long b);      RatNum();      void show();      RatNum operator+(RatNum nx) ;      RatNum operator++() ;      RatNum operator++(int) ;      RatNum ...

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.