Question: 6.What's wrong with the following class definition? Defend your answer. class Fraction; // Forward Declaration // Function Prototypes for Overloaded Stream Operators ostream &operator <
6.What's wrong with the following class definition? Defend your answer. class Fraction; // Forward Declaration // Function Prototypes for Overloaded Stream Operators ostream &operator << (ostream &, const Fraction &); istream &operator >> (istream &, Fraction &); class Fraction{ private: int numerator; int denominator; public: // Constructors // ... // Setters // ... // Getters // ... // Overloaded operator functions Fraction operator+ (const Fraction &); // Overloaded + Fraction operator-(const Fraction &); // Overloaded - Fraction operator++ ();// Prefix ++ Fraction operator++ (int);// Postfix ++ Fraction operator--(); // Prefix -- Fraction operator--(int); // Postfix -- bool operator> (const Fraction &); // Overloaded > bool operator< (const Fraction &); // Overloaded < bool operator== (const Fraction &); // Overloaded == ostream &operator<< (ostream &, const Fraction &); istream &operator>> (istream &, Fraction &); };
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
