Given the following class declaration,

class Rational
{
public:
Rational();
Rational(int numer, int denom);

int getNumerator() const;
int getDenominator() const;

friend void display(ostream& out, const Rational& value);

friend bool operator(const Rational& left, const Rational& right);
private:
int numerator;
int denominator;
};

what must we add to the class in order for the following code to compile?
Rational myRational(2,3);
if ( 3 < myRational)
a. We need another < operator that expects an integer as the second parameter.
b. We need another < operator that expects an integer as the first parameter.
c. We need a constructor that expects a ration number
d. We need a constructor that expects an integer
e. A or D
f. B or D

f. B or D

Computer Science & Information Technology

You might also like to view...

Once a device has failed, what metric measures the average amount of time to repair?

a. mean time to repair (MTTR) b. mean time to restore (MTTR) c. mean field replacement time (MFRT) d. mean restoration time (MRT)

Computer Science & Information Technology

What is Prim's algorithm?

a. An algorithm to determine the minimum spanning tree b. A searching algorithm c. An algorithm to compute the weighted average of edges in a graph d. It is an optimized form of Dijkstra's algorithm

Computer Science & Information Technology